我正在尝试查询列出总数为PTNG_PRICE超过7000的PTR_NUM。我正在尝试这样做:
SELECT painter.PTR_FIRSTNAME, painter.PTR_LASTNAME,
SUM(painting.PTNG_PRICE) AS 'TOTAL PAINTING COST'
FROM painter, painting
WHERE painter.PTR_NUM = painting.PTR_NUM
AND SUM(painting.PTNG_PRICE) > 7000
GROUP BY painter.PTR_NUM;
我收到1111错误。
答案 0 :(得分:1)
SELECT painter.PTR_FIRSTNAME, painter.PTR_LASTNAME,
SUM(painting.PTNG_PRICE) AS 'TOTAL PAINTING COST'
FROM painter, painting
WHERE painter.PTR_NUM = painting.PTR_NUM
GROUP BY painter.PTR_NUM
HAVING SUM(painting.PTNG_PRICE) > 7000;