tags:

views:

52

answers:

1

Hey guys,

I'm using DB2 and I have two tables that have a million+ rows in them. Is there a query I can create that will check the two tables to see if all the values in the two are the same? Or, what is the best way to do this?

Thanks, Tyler

+1  A: 

Use:

SELECT * 
  FROM TABLE_A
INTERSECT
SELECT *
  FROM TABLE_B

...assuming columns are identical. For more info on INTERSECT (and EXCEPT), see this article.

OMG Ponies
With a million+ rows invovled, I would suggest making that a subquery in a "select count(*) from..." statement.
Philip Kelley
@Philip Kelley: But the OP was to see values. At least, that's how I read it...
OMG Ponies