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)
 Need query

Author  Topic 

sql2020
Yak Posting Veteran

54 Posts

Posted - 2010-11-23 : 06:19:43
I have Table A and B.
Table A under sample database, B table under sample2 database

if

USE sample
Select * from A
Results is 1000 rows

if
Use sample2
Select * from B
Results is 1100 rows

i want query for that extra 100 rows only. help on this

sql2020

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2010-11-23 : 06:23:54
You need a unique column in bot tables to join on.
select b.*
from b
left join a
on a.col = b.col
where a.col is null

or maybe
select * from b
except
select * from a
(it's v2000 so this might not work - don't think it was available in that release)

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-11-23 : 07:32:03
quote:
Originally posted by nigelrivett

You need a unique column in bot tables to join on.
select b.*
from sample2..b as b
left join sample..a as a
on a.col = b.col
where a.col is null

or maybe
select * from b
except
select * from a
(it's v2000 so this might not work - don't think it was available in that release)

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.




No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -