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
 Transact-SQL (2000)
 problem with my select

Author  Topic 

unicorn
Starting Member

3 Posts

Posted - 2006-08-21 : 01:14:51
Hello
I used this query in mysql to take out records from the second table that there is'nt a corresponding ID for them in the first table

SELECT * 
FROM (
first f
LEFT JOIN second s ON f.courseId = s.courseId
)
WHERE isnull( s.userId )

it works fine, Now I'm using sql server and use the folloing query to do the same

SELECT * 
FROM (
first f
LEFT JOIN second s ON f.courseId = s.courseId
)
WHERE s.userId=NULL

but it returns no records! what's the problem?
thanks in advance.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-08-21 : 01:36:30
use

WHERE s.userId IS NULL


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2006-08-21 : 03:39:17
wouldn't an INNER JOIN accomplish this too?



-ec
Go to Top of Page
   

- Advertisement -