select100 from Product as A leftjoin ProductService as B on A.Id = B.ProductId and B.ServiceId =1 where B.ServiceId isnull
這樣就可以找出 沒有1對1服務的產品了
那如果更進一步 要找出沒有1對1 但是有1對4服務的產品 同樣的思路可以再用一次 多一個join
1 2 3 4 5
select100 from Product as A leftjoin ProductService as B on A.Id = B.ProductId and B.ServiceId =1 leftjoin ProductService as B2 on A.Id = B2.ProductId and B2.ServiceId =3 where B.ServiceId isnulland B2.ServiceId isnotnull