0
我有兩個表,訂單和客戶,我試圖返回沒有訂單的客戶的客戶ID和名稱。在其他表中沒有發生SQL查詢返回條目
customers
customerID: integer
name: string
orders
orderID: integer
itemID: integer
customerID: integer
date: date
我目前還沒有返回任何結果:
SELECT customers.customerID, customers.fName, orders.date
FROM orders INNER JOIN customers
ON orders.customerID = customers.customerID
GROUP BY orders.customerID
HAVING COUNT(*) = 0
如果你是客戶ID試圖組,並試圖打印3列,查詢將不會工作在第一位。通過http://www.informit.com/articles/article.aspx?p=664143&seqNum=6閱讀寫作小組的基本邏輯 – user1658435