Skip to content Skip to sidebar Skip to footer

Compare Data Two Table In Mysql

There are two tables Table A id column_a 01 abc 01 abc 02 abc 02 abc 02 abc 03 abc 03 abc 04 abc Table B id column_b 01 abc 02 abc 02 abc 03 abc 04 abc I'd like to compare those

Solution 1:

SELECT A.*FROM A
LEFTJOIN B ON A.column_a = B.column_b AND A.id = B.id
WHERE B.id ISNULL

Solution 2:

Try

SELECT A.*FROM A
LEFTJOIN B ON A.ID=B.ID AND A.column_a=B.column_b
WHERE B.ID ISNULL

Regards

Solution 3:

try this:

select a.id,a.column_a
from (selectcount(*) as a_num, id,column_a 
from table_a groupby id havingcount(*) >1) as a 
leftjoin (selectcount(*) as b_num, id from table_b groupby id havingcount(*) >1) as b 
on a.a_num > b.b_num;

Post a Comment for "Compare Data Two Table In Mysql"