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 -- Posted via http://www.ruby-forum.com/.
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 helpAlso, one of the conditions of the SQL will user some pagination params from a plugin -- Posted via http://www.ruby-forum.com/.
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 pluginOnce again, already solved. Using subqueries. -- Posted via http://www.ruby-forum.com/.
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, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.