how to compare two queries returned rows?

lok1234

Registered User.
Local time
Yesterday, 20:23
Joined
Nov 26, 2008
Messages
22
Dear all,

Assume I have two queries getting similar records from different tables:

Query1
-------
Select stockname, transaction_date, amount from TableA
where transaction_date = #21-04-2009#

Query2
-------
Select stockname, transaction_date, amount from TableB
where transaction_date = #21-04-2009#


I want to "diff" this two queries result. If they are not identical, it will return >1 ; if the result sets are exactly the same, it will return 0

Can I do this thing in Query?

I have though about something like that:

select count(*) from
(Select stockname, transaction_date, amount from TableA
where transaction_date = #21-04-2009#
order by stockname, transaction_date, amount ) as a,
(Select stockname, transaction_date, amount from TableB
where transaction_date = #21-04-2009#
order by stockname, transaction_date, amount) as b
where a.stockname=b.stockname
and a.transaction_Date=b.transaction_date
and a.amount <> b.amount

But this can only check if the amount of two tables identical, it cannot check the number of rows of two queries return..
 
Use the UnmatchedQuery wizard
 

Users who are viewing this thread

Back
Top Bottom