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)
 select

Author  Topic 

fmardani
Constraint Violating Yak Guru

433 Posts

Posted - 2005-07-07 : 03:26:42
1)select * from tblPhoneBook where companyid=1 and lastname = 'judge'
2)select * from tblPhoneBookFeedSAP where lastname = 'judge' 3)select *
from tblPhoneBook where firstname not in (select firstname from
tblPhoneBookFeedSAP)

query 1 returns one record
query 2 returns no record
why query 3 does not return one record?

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-07-07 : 03:34:40
Give sample data

Madhivanan

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

fmardani
Constraint Violating Yak Guru

433 Posts

Posted - 2005-07-07 : 03:39:18
Hi,
there is just one record with lastname='judge'
the other fields are null

p.s. slight misspelling in the previous post for step 3)

select * from tblPhoneBook where companyid=1 and lastname = 'judge'
select * from tblPhoneBookFeedSAP where lastname = 'judge'
select lastname from tblPhoneBook
where lastname not in (select lastname from tblPhoneBookFeedSAP)
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-07-07 : 04:28:20
you queried not in, so if you're expecting judge, you shouldn't coz judge exists in both tables, if you want to see 'judge' remove 'not'



--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -