This is correct.
WHERE clause returns (1,1)
HAVING eliminates all records not HAVING f2=3.


[EMAIL PROTECTED] wrote:


Description:


HAVING in SELECT is evaluated before WHERE. This is not the correct behaviour as HAVING should deal with the remainder of the WHERE selection (according to manual)


How-To-Repeat:


mysql: create table tt (f1 int, f2 int);
Query OK, 0 rows affected (0.01 sec)

mysql: insert into tt values(1,1);
Query OK, 1 row affected (0.01 sec)

mysql: insert into tt values(1,2);
Query OK, 1 row affected (0.00 sec)

mysql: insert into tt values(2,3);
Query OK, 1 row affected (0.00 sec)

mysql: select * from tt where f1=1 having f2=max(f2);
Empty set (0.00 sec)






--------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



Reply via email to