Re: extracting set differences from a db

Michele Costabile <[email protected]> Fri, 13 Mar 2009 21:40:14 +0100
Newsgroups gmane.comp.programming.language-of-the-year
Message-ID <[email protected]>
Bumped into this googling for "sql difference of two sets":
http://sqlblog.com/blogs/louis_davidson/archive/2007/02/08/getting-the-difference-between-two-sets-of-like-data.aspx

Maybe the thid method described could be more efficiently implemented
than except

select  tableA.column1 as column1_A, tableA.column2 as column2_A,
          tableB.column1 as column1_B, tableB.column2 as column2_B
from   tableA
              full outer join tableB
                  on tableA.column1 = tableB.column1
                       and tableA.column2 = tableB.column2
where  (tableA.column1 is null and tableA.column2 is null)
   or     (tableB.column1 is null and tableB.column1 is null)

Michele Costabile (http://proxybar.net)