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,196 of 19,505    |
|    Bob Barrows to Alfaking    |
|    Re: I Need help with a query...    |
|    05 Apr 11 07:17:59    |
      57017672       From: reb01501@NOSPAMyahoo.com              Alfaking wrote:       > hello.       > I need help with a query please...       > I've a table like this       >       > Id | Contr | Type       >       > the content of this table is like       >       > Id | Contract | Type       > 1 | 1250 | W       > 2 | 1250 | T       > 3 | 5555 | W       > 4 | 6666 | T       > 5 | 7777 | W       > 6 | 6666 | W       > 7 | 6666 | W       > 8 | 6666 | T       > 9 | 7777 | W       > 10 | 1250 | W       > 11 | 1250 | T       > 12 | 1250 | W       > 13 | 1250 | T       > 14 | 1250 | T       >       > the key is the ID       >       > I need to extract all the "Contr" where type is not "T"       > so i should have as result       > 3 | 5555 | W       > 5 | 7777 | W       >       > 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 ?       >       > thanks in advance       >       > p.s.sorry for my english, I'm Italian. I really hope you can       > understand me...              Are 'W' and "T" the only allowable types? If so:              SELECT min(id),Contr,max(Type)       FROM table       GROUP BY Contr       HAVING max(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