-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Thanks for starting this discussion! I think the problem is that the order by clause needs to be part of the aggregate function invocation, the order is technically still undefined even when using a statement-wide ordering. Fixing this right now is not trivial since drift's query builder is not currently exporting a way to write aggregate functions (fixed in a68ec2a). So in the next drift release, you could simply do |
Beta Was this translation helpful? Give feedback.
Thanks for starting this discussion! I think the problem is that the order by clause needs to be part of the aggregate function invocation, the order is technically still undefined even when using a statement-wide ordering.
Fixing this right now is not trivial since drift's query builder is not currently exporting a way to write aggregate functions (fixed in a68ec2a). So in the next drift release, you could simply do
childInfo.id.jsonGroupArray(orderBy: OrderBy([OrderingTerm.asc(childInfo.left)]))
. Until then, I think the most viable option is to use aCustomExpression
with the manual SQL invocation (e.g.json_group_array(childInfo.id ORDER BY childInfo.left ASC)
.