SELECT orderyear, numcusts
FROM (SELECT orderyear, COUNT (DISTINCT custid) AS numcustd
FROM (SELECT YEAR ()orderdate) AS orderyear, custid
FROM sales,Orders) AS D1
GROUP BY orderyear) AS D2
WHERE numcusts > 70;
答案 0 :(得分:0)
试试这个:
SELECT D1.orderyear, D1.numcustd
FROM (
SELECT YEAR(orderyear) as orderyear, COUNT (DISTINCT custid) AS numcustd
FROM sales,Orders
GROUP BY orderyear
) AS D1
WHERE numcusts > 70;