Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SIMPLE SQL JOINS HELP 1

Status
Not open for further replies.

mr2tho

Programmer
Mar 30, 2006
25
US
Hi,
I have two views with exact same column names...
One of the view has 4500 records, the other has 4508 records.

How can I see this 8 records, vwA-vwB?
I have been playing with all kind of join, I just couldn't get 8 records :)

Your help would be appreciated.
Have a great night.
 
select col1 from tab1
where col1 not in (select col1 from tab2)

or something like that
 
Actually this doesn't work for me because a view doesn't have primary keys. I need the whole different record. The two views are supposed to give the same records, one of them is giving couple extra. Let me see if I can explain:

View1
1 970-010-1641 1641
2 970-010-1621 1621
3 970-010-1631 1631

View2
1 970-010-1641 1641
2 970-010-1621 1621
2 970-010-1631 1631
3 970-010-1631 1631

So as you see view2 has extra record, I just want to find that record.
 
Can someone profesional can at least write that what I am thinking is not possible so that I wouldn't be looking into that. I would really appreciate it. Thanks for all comments in advance.
 
Either join on all columns or use simple trick with CHECKSUM(*).

------
[small]<this is sig>
select stuff(stuff(replicate('<P> <B> ', 14), 109, 0, '<.'), 112, 0, '/')
</this is sig>[/small]
[banghead]
 
Could you maybe give the sql syntax that would be giving me the only one record as in the example above.
 
if u have the same records in each table u can use a where not exists query to find the records that are in the first table but not in the second
the code is something like

select columns
from table1 (table with more records)
where not exists
(select *
from table 2
where table1 unique column = table2 unique column)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top