Breaking News
Loading...
15/12/2013

MySQL Compare Two Tables

This is an useful tip when working with MySQL, I think we can also apply this to SQL Server.
SELECT id,title
FROM (
SELECT id, title FROM t1
UNION ALL
SELECT id,title FROM t2
) tbl
GROUP BY id, title
HAVING count(*) = 1
ORDER BY id;

http://www.mysqltutorial.org/compare-two-tables-to-find-unmatched-records-mysql.aspx

0 comments:

Post a Comment

 
Toggle Footer