Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mihamil
Starting Member
8 Posts |
Posted - 2008-08-15 : 13:42:44
|
| I have this query which returns all active offices in our database. select Office_Number, Association_ID, Statusfrom Office_Associationwhere Association_ID in ('STL','STC','ECBR','FRN','JEF')and Status='A'I want to get a list of all offices in the same table that are not included in the results from the query above.I cannot think of a way to do this? Could you please help?Thanks in advance |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-15 : 13:55:58
|
| [code]SELECT oa.Office_Number, oa.Association_ID, oa.StatusFROM Office_Association oaLEFT JOIN (select Association_IDfrom Office_Associationwhere Association_ID in ('STL','STC','ECBR','FRN','JEF')and Status='A')tmpON tmp.Association_ID=oa.Association_IDWHERE tmp.Association_ID IS NULL[/code] |
 |
|
|
|
|
|