laravel-json-query-builder icon indicating copy to clipboard operation
laravel-json-query-builder copied to clipboard

Add aggregation and Sql Functions Support

Open nealarec opened this issue 10 months ago • 0 comments

Aggregation and Sql Functions Support

Now you can use aggregations and some SQL functions like sum, avg, month or year in this way ave:year:column_name, you can also count on the group by query count:distinct:name

Return aggregations:

{
  "returns": ["year:date", "month:date", "sum:value"],
  "group_by": ["year_date", "month_date"]
}

Will perform SELECT year(date) as year_date, month(date) as month_date, sum(value) FROM ... GROUP BY year_date, month_date

You can also nest functions as your convenience like:

{
  "returns": ["min:year:date"]
}

Will perform SELECT min(year(date)) as min_year_date FROM ...

You can read more on SQLFunctions and DatabaseFunctions

nealarec avatar Apr 04 '24 19:04 nealarec