
Untitled
By: a guest on
Apr 25th, 2012 | syntax:
None | size: 0.58 KB | hits: 13 | expires: Never
SQL query to check whether the values are same in two tables
spsscode spssdescription brpcode brpdescripton
1 cash deposit x cash deposit
7 withdraw y withdraw
8 cheque deposit w cheque deposit
9 bank transfer v bank transfer
select spsscode, spssdescription, brpcode, brpdescripton, min(which_table)
from
(select t.*, 'old' which_table from oldtable t
union all
select t.*, 'new' which_table from newtable t) v
group by spsscode, spssdescription, brpcode, brpdescripton
having count(*) < 2