Row count comparison for 2 tables
Need to compare the rowcount for 2 tables to see if they're identical or not, in a single sql statement. Here's what I got...
WHEN (SELECT COUNT(*) FROM TMP_JP_W_PERSON) =
(SELECT COUNT(*) FROM W_PERSON)
ELSE 'NO MATCH'
END) "NUM OF ROWS"
WHERE TABLE_NAME = 'TMP_JP_W_PERSON';
TABLE_NAME NUM OF ROWS
TMP_JP_W_PERSON NO MATCH
There has to be a much more elegant way of doing this. Code is not my strong point.
Any help would be appreciated.
select a.count, b.count, a.count-b.count diff
select count(*) count from table A
select count(*) count from table B
Yeah, that's given me an idea, thanks.
Click Here to Expand Forum to Full Width