On Jun 23, 8:39 am, Chirag Singhal <
chirag.sing...@gmail.com> wrote:
> Strictly speaking, both the adapters are implementing what's right as per
> each database.
> And since MySQL chose to implement "group by" clause differently and most
> rails devs have been using mysql as default database, we are used to use
> "group by" the mysql way.
Actually, MySQL defaults to allowing you to do non standard group by
operations.
http://dev.mysql.com/doc/refman/5.1/en/server-sql-mode.html#sqlmode_only_full_group_by
As the link points out, the following query is allowed when the
ONLY_FULL_GROUP_BY option is not enabled (which I think is the
default):
SELECT name, address, MAX(age) FROM t GROUP BY name;
I've always thought this was a really bad default for MySQL, and
PostgreSQL is rightfully complaining that the query should be:
SELECT name, address, MAX(age) FROM t GROUP BY name, address;
- Eric