-
sql to compare two tables
Can someone please help with a sql that will compare two tables having same column name for a missing row?
Tanks in advance
-
select * from table 1 minus select * from table 2
-
Originally Posted by davey23uk
select * from table1 minus select * from table2
Support Dave but please be sure table2 is the one with the less rows.
Query does full scan on table1 selecting * then, full scan on table2 taking out of the result set all matching rows.
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
-
if there is a unique column you can just do the minus on that as it'll be faster
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|