求差集:表1-表2的差

求差集:表1-表2的差
#方法1
SELECT t1.id t1d,t2.id t2d
FROM lishi_sports_data_copy20170817 t1 LEFT JOIN lishi_sports_copy20170817 t2 ON t1.id = t2.id
WHERE  t2.id is NULL;
#方法2
SELECT lishi_sports_data_copy20170817.id from lishi_sports_data_copy20170817 where  not EXISTS(SELECT lishi_sports_copy20170817.id from lishi_sports_copy20170817 where lishi_sports_copy20170817.id = lishi_sports_data_copy20170817.id);

你可能感兴趣的:(求差集:表1-表2的差)