Christopher Kings-Lynne <chriskl@familyhealth.com.au> writes:
>>> Comments? Can anyone confirm whether DB2 or other databases allow
>>> ungrouped column references with HAVING?
> MySQL allows it:
A slightly tighter experiment shows that they treat HAVING like WHERE
in this case:
mysql> create table tab(col int);
Query OK, 0 rows affected (0.00 sec)
mysql> insert into tab values(1);
Query OK, 1 row affected (0.00 sec)
mysql> insert into tab values(2);
Query OK, 1 row affected (0.01 sec)
mysql> select col from tab having col>1;
+------+
| col |
+------+
| 2 |
+------+
1 row in set (0.00 sec)
I think it's fairly likely that they copied our misinterpretation ...
regards, tom lane