1
我想知道這兩個代碼塊之間有什麼區別,因爲對於我來說,它看起來會顯示相同的結果。IN與<>(不等於)和NOT IN與=(等於)之間的區別
我們正在查找「commande」表中沒有「stylo」文章的所有記錄。
SELECT Commande.Numero, Commande.ClientNo
FROM Commande
WHERE (Commande.Numero, Commande.ClientNo) IN (
SELECT LigneCommande.CommandeNo, LigneCommande.ClientNo
FROM LigneCommande
INNER JOIN Article AS A
ON A.Numero = LigneCommande.ArticleNo
WHERE A.Designation <> 'Stylo')
SELECT Commande.Numero, Commande.ClientNo
FROM Commande
WHERE (Commande.Numero, Commande.ClientNo) NOT IN (
SELECT LigneCommande.CommandeNo, LigneCommande.ClientNo
FROM LigneCommande
INNER JOIN Article AS A
ON A.Numero = LigneCommande.ArticleNo
WHERE A.Designation = 'Stylo')
非常感謝您的快速和明確的答案,我現在得到了不同的結果! –