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 |
|
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 fromtblPhoneBookFeedSAP)query 1 returns one recordquery 2 returns no recordwhy query 3 does not return one record? |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-07-07 : 03:34:40
|
| Give sample dataMadhivananFailing to plan is Planning to fail |
 |
|
|
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 nullp.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 tblPhoneBookwhere lastname not in (select lastname from tblPhoneBookFeedSAP) |
 |
|
|
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... |
 |
|
|
|
|
|