May 15, 2008 at 3:43 am
Hi Experts,
I have to find discrepancy between two tables
I have Table 1 with columns
OrderID
Date
Quantity
Symbol
Table 2 with columns
OrderID
Date
Quantity
Symbol
I want a script to find out a list of OrderIDs present in table1 but not in table 2 and a list of OrderIDs present in table2 but not in table 1.
Could any one help me in writing this query?
Thanks in advance
May 15, 2008 at 3:55 am
Try this:
select OrderID, Date, Quantity, Symbol from table1 where not exists(select * from table2 where OrderID = table1.OrderID) -- rows present in table1 that aren't in table2
May 15, 2008 at 4:05 am
hi ,
write a select query using a full outer join between the two tables on orderid where orderId is null
will select only the differnce in orderId between the two tables
Regards,
Rajesh
May 15, 2008 at 4:06 am
Thanks for the script , it is working fine
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply