Dreamfactory:如何在查询中使用MySQL聚合函数?

时间:2020-12-29 22:31:00

I am using Dreamfactory version 2.1.0 with MySQL database. I have created a virtual field named vcol1 for SUM(col1) in the Schema, marked it as aggregate and defined the field, and specified the return type. But when I mention the field as vcol1 in the api_docs,I get value 0 for all records.

我使用Dreamfactory版本2.1.0与MySQL数据库。我在Schema中为SUM(col1)创建了一个名为vcol1的虚拟字段,将其标记为聚合并​​定义了字段,并指定了返回类型。但是当我在api_docs中将字段提到vcol1时,我得到的值为0。

How can I query the following using api?

如何使用api查询以下内容?

SELECT col0,SUM(col1)
FROM tablename
WHERE col2=x
GROUP BY col3

1 个解决方案

#1


0  

I think this is what you are looking for.

我想这就是你要找的东西。

http://{server}/api/v2/{service}/_table/{table_name}?filter=col2=x&group=col3&fields=col3,col0,vcol1`

#1


0  

I think this is what you are looking for.

我想这就是你要找的东西。

http://{server}/api/v2/{service}/_table/{table_name}?filter=col2=x&group=col3&fields=col3,col0,vcol1`