Heo, Monday, September 30, 2002, 6:20:53 AM, you wrote: HJ> I have a following table.
HJ> mysql> SELECT * FROM group_test ; HJ> +------+------+------+ HJ> | a | b | c | HJ> +------+------+------+ HJ> | 1 | 1 | 1 | HJ> | 1 | 1 | 1 | HJ> | 1 | 1 | 1 | HJ> | 2 | 2 | 2 | HJ> | 2 | 2 | 2 | HJ> | 3 | 3 | 3 | HJ> +------+------+------+ HJ> 6 rows in set (0.00 sec) HJ> mysql> SELECt a, COUNT(*) FROM group_test HJ> -> GROUP BY a, b ; HJ> +------+----------+ HJ> | a | COUNT(*) | HJ> +------+----------+ HJ> | 1 | 3 | HJ> | 2 | 2 | HJ> | 3 | 1 | HJ> +------+----------+ HJ> 3 rows in set (0.00 sec) HJ> But, when I use HAVING and IN() togather, MySQL returns no rows. HJ> mysql> SELECt a, COUNT(*) FROM group_test HJ> -> GROUP BY a, b HJ> -> HAVING COUNT(*) IN ( 1, 2, 3 ) ; HJ> Empty set (0.00 sec) HJ> Other relational operators works well. HJ> I'm using MySQL 4.0.3 Thank you for bug report, it was fixed. Currently you can avoid this problem using alias, like mysql> SELECt a, COUNT(*) as cnt FROM group_test GROUP BY a, b HAVING cnt IN ( 1, 2, 3 ) ; +------+-----+ | a | cnt | +------+-----+ | 1 | 3 | | 2 | 2 | | 3 | 1 | +------+-----+ 3 rows in set (0.01 sec) -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Victoria Reznichenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net <___/ www.mysql.com --------------------------------------------------------------------- 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