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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Replacing NOT IN

Author  Topic 

rajesh_b_2k
Starting Member

1 Post

Posted - 2004-09-30 : 23:53:32
Hi all,
I have a query like this. I want to rewrite this query using joins.

SELECT dev.device_id
FROM SC_Device DEV
WHERE device_id NOT IN
(SELECT DEVICE_ID FROM SC_DDG_Map map
WHERE device_group_id = 7)

I tried it but the query takes more time. Is there any other way to tune this query in MSSQL server? Any help would be of help.

~Rajesh.B

hgorijal
Constraint Violating Yak Guru

277 Posts

Posted - 2004-10-01 : 04:36:36
SELECT dev.device_id
FROM SC_Device DEV
WHERE not exists (SELECT DEVICE_ID FROM SC_DDG_Map map WHERE device_group_id = 7 and map.device_id = dev.device_id )

Hemanth Gorijala
BI Architect / DBA...
Go to Top of Page
   

- Advertisement -