Skip to main content
Version: Latest(3.11)

QueryAggregateExpression 查询聚合函数

1. 结构声明

class QueryAggregateExpression extends LogicItem {
asName?: string;
aggregateName: 'COUNT' | 'COUNTD' | 'SUM' | 'AVG' | 'MAX' | 'MIN';
aggregateParam: QueryFieldExpression;
}

2. 节点示例

(1) 示例

AST 如下:

{
"concept": "QueryAggregateExpression",
"aggregateName": "SUM",
"aggregateParam": {
"concept": "QueryFieldExpression",
"isDotStar": false,
"entityAsName": "OrderProduct",
"propertyName": "amount",
"asName": ""
},
"asName": "totalAmount"
}

对应的代码如下:

totalAmount: SUM(OrderProduct.amount)