home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 18,198 of 19,505   
   Bob Barrows to Alfaking   
   Re: I Need help with a query...   
   05 Apr 11 07:38:44   
   
   57017672   
   From: reb01501@NOSPAMyahoo.com   
      
   Alfaking wrote:   
   > hello.   
   > I need help with a query please...   
   > whenever i found a type "T", I have to exclude that number of "contr".   
   >   
   > I'm able to exclude all the records where type is not "T", but if I   
   > found type ="T", that contr goes into results because of the ID   
   > field...   
   >   
   > any idea of how I can do this ?   
      
   Just to follow up, if other contract types exist, and you need to retrieve   
   all IDs and types for the contracts that don't have a T type, then this will   
   do it:   
      
   select id,contr,type   
   from table t   
   where not exists (   
   select * from table where   
   contr = t.contr and type = 'T')   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca