Return to Snippet

Revision: 67161
at August 18, 2014 08:23 by lottegis


Initial Code
--1. Find what's present in table A.
--Syntax

SELECT A.*
FROM A LEFT JOIN B ON (A.C = B.C)
WHERE B.C IS NULL;

 
--Example
SELECT NEW.*
FROM AlbertaData.SWG_650s20130312 AS NEW
     LEFT JOIN AlbertaData.SWG_650s20130101 AS OLD
     ON (NEW.OBJECTID = OLD.OBJECTID)
WHERE OLD.OBJECTID IS NULL;

 

--2. Find all the differences between tables:
--Syntax

SELECT A.*, B.*
FROM A FULL JOIN B ON (A.C = B.C)
WHERE A.C IS NULL OR B.C IS NULL;

Initial URL


Initial Description
Example below

Initial Title
Compare table difference

Initial Tags


Initial Language
SQL