两个表查询,查出左表有的,但右表没有的数据

select * from (select g.ProductListID as gp,l.ProductListId as lp from GenerateLog as l
 left join GenerateProductList as g
on l.ProductListId = g.ProductListID) as t where t.gp is null

原文地址:https://www.cnblogs.com/guozhe/p/3402126.html