日期:2014-05-18 浏览次数:20800 次
SELECT b.chanpin FROM customer a LEFT JOIN zy b ON a.char01 = b.chanpin --从上面看,就是取了所有zy与customer中都有的行b.chanpin WHERE b.chanpin NOT IN ( SELECT a.char01 FROM customer ) --再从这些行里面筛选不在customer表中的,所以为0行 --比较差异的话 SELECT a.* FROM customer a WHERE NOT EXISTS(SELECT 1 FROM zy b WHERE b.chanpin = a.char01) SELECT char01 FROM customer EXCEPT SELECT chanpin FROM zy