Help with Postgre, GROUP BY and ORDER BY

John Smith wrote:

John Smith wrote:

I want to obtain a array group by a field_1 of a table but ordered by a
field_2 of a table, with one line of code. How can I do that using
Postgre? I'll appreciate any help

Also, one of the conditions of the SQL will user some pagination params
from a plugin

Once again, already solved. Using subqueries.

John Smith wrote:

John Smith wrote:

John Smith wrote:

I want to obtain a array group by a field_1 of a table but ordered by a
field_2 of a table, with one line of code. How can I do that using
Postgre? I'll appreciate any help

Also, one of the conditions of the SQL will user some pagination params
from a plugin

Once again, already solved. Using subqueries.

Why? I believe you should just be able to do
GROUP BY field_1
ORDER BY field_1, field_2

Best,