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 |
divan
Posting Yak Master
153 Posts |
Posted - 2013-02-04 : 16:06:35
|
I have created a temp file with all the agency_id that are in a policy file.. There are a lot more ageny_id in the agency file. Now I need to see which of the agency_id in the agency file are not in my temp file..SELECT DISTINCT AGENCY_ID INTO #TEMP1FROM POLICY WHERE POLICY_NUMBER NOT LIKE '%Q%' AND AGENCY_ID IS NOT NULL ORDER BY AGENCY_IDany help will be very much appreciated.. |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2013-02-04 : 16:33:03
|
by "file" I assume you mean TABLE, right?select a.agency_idfrom agency aleft outer join #temp1 t on t.agency_id = a.agency_idwhere t.agency_id is nullBe One with the OptimizerTG |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-02-04 : 22:50:09
|
[code]select agency_idfrom agency aWHERE NOT EXISTS(SELECT 1 FROM #temp1 WHERE agency_id = t.agency_id)[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|