select * from (
select Table1.*,Table1.ID as IDD from Table1
left join Table2 on Table2.ID=Table1.ID) as a
where a.IDD is not null
select Table1.*,Table1.ID as IDD from Table1
left join Table2 on Table2.ID=Table1.ID) as a
where a.IDD is not null
where id not in(select 产品ID from table2)
select Table1.*,Table1.ID as IDD from Table1
left join Table2 on Table2.ID=Table1.ID) as a
where a.IDD is null
from table1 a
where not exists(select 1 from table2 where id = a.id)
--子查詢
Select Distinct Table1.ID
From Table1
Where Table1.ID Not In (Select Distinct Table2.ID From Table2)
--左聯接
Select Distinct Table1.ID
From Table1 Left Join Table2 On Table1.ID=Table2.ID
Where Table2.ID Is NULL
select * from Table1 where id not in (select id from Table2)