Subject | Re: [firebird-support] How to compare two tables? |
---|---|
Author | Raymond Kennington |
Post date | 2003-07-15T23:51:18Z |
Raymond Kennington wrote:
SELECT A.Employer_ID, A.Employer_ID, B.Salary, B.Salary
FROM A FULL OUTER JOIN B
ON A.Employer_ID = B.Employer_ID
WHERE NOT ( (A.Employer_ID = B.Employer_ID)
AND (A.Salary = B.Salary))
Conditions for NULLs could be included, but I think they are
irrelevant.
--
Raymond Kennington
Programming Solutions
TeamW2W (InfoPower)
>Replace my last suggestion with:
> Marco Menardi wrote:
> >
> > Hi, is there a "clever" sql way to compare two tables?
> > Put that table A and table B have this structure:
> > EMPLOYER_ID, SALARY
> > I want to find:
> > a) if A has EMPLOYERS (records) that B misses
> > b) if B has EMPLOYERS (records) that A misses
> > c) if an employer in A table has a different salary than the same has
> > in B table (an vice versa, but seems not necessary to check ;))
SELECT A.Employer_ID, A.Employer_ID, B.Salary, B.Salary
FROM A FULL OUTER JOIN B
ON A.Employer_ID = B.Employer_ID
WHERE NOT ( (A.Employer_ID = B.Employer_ID)
AND (A.Salary = B.Salary))
Conditions for NULLs could be included, but I think they are
irrelevant.
--
Raymond Kennington
Programming Solutions
TeamW2W (InfoPower)