【发布时间】:2018-10-05 11:33:17
【问题描述】:
我有一个家庭作业问题,我遇到了一些麻烦。我被问到我们数据库中从未售出的产品总数。
应该是这样的:
+--------------------------------------------+
| number of products that have not been sold |
+--------------------------------------------+
| 228 |
+--------------------------------------------+
我不断收到这个:
+--------------------------------------------+
| number of products that have not been sold |
+--------------------------------------------+
| 0 |
+--------------------------------------------+
我的查询是:
SELECT count(*) AS 'number of products that have not been sold'
FROM orderdetail
JOIN invoice on invoice.invoiceid=orderdetail.invoiceid
WHERE productid is null;
【问题讨论】: