本文共 468 字,大约阅读时间需要 1 分钟。
您需要添加HAVING子句,才能使WHERE语句和合计函数一起运用。
SELECT [ ALL | DISTINCT ]{ * | projectItem [, projectItem ]* }
FROM tableExpression
[ WHERE booleanExpression ]
[ GROUP BY { groupItem [, groupItem ]* } ]
[ HAVING booleanExpression ];
Customer | OrderPrice |
---|---|
Bush | 1000 |
Carter | 1600 |
Bush | 700 |
Bush | 300 |
Adams | 2000 |
Carter | 100 |
SELECT Customer,SUM(OrderPrice) FROM XXX
GROUP BY Customer
HAVING SUM(OrderPrice)<2000;
Customer | SUM(OrderPrice) |
---|---|
Carter | 1700 |
转载地址:http://jqdmx.baihongyu.com/