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