How to write an action to run the following query?
SELECT COUNT(field1), SUM(field2) FROM table WHERE field3 = value;
How to write an action to run the following query?
SELECT COUNT(field1), SUM(field2) FROM table WHERE field3 = value;
Resource
|> Ash.Query.filter(field3 == ^value)
|> Api.aggregate!([{:foo, :count, field: :field1}, {:bar, :sum, field: :field2}])
#=> %{foo: 10, bar: 25}
Thanks, Zach.