>I found a very strange behaviour of MySQL 3.23.xx with GROUP BY clause ... > >I have a Table: > >CREATE TABLE groupbyTEST ( > fldNAME varchar(20) NOT NULL, > fldMONTH tinyint(4) DEFAULT '0' NOT NULL, > fldSALARY decimal(10,0) DEFAULT '0' NOT NULL, > fldDATE datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, > PRIMARY KEY (fldNAME, fldMONTH) >); > >with following records: > >INSERT INTO groupbyTEST VALUES ( 'stephan', '1', '1000', '2001-01-25 >23:12:29'); >INSERT INTO groupbyTEST VALUES ( 'boris', '1', '2000', '2001-01-25 >23:12:45'); >INSERT INTO groupbyTEST VALUES ( 'stephan', '2', '1200', '2001-01-25 >23:12:56'); >INSERT INTO groupbyTEST VALUES ( 'stephan', '3', '1000', '2001-01-25 >23:13:08'); >INSERT INTO groupbyTEST VALUES ( 'stephan', '4', '900', '2001-01-25 >23:14:50'); >INSERT INTO groupbyTEST VALUES ( 'boris', '2', '1200', '2001-01-25 >23:15:01'); >INSERT INTO groupbyTEST VALUES ( 'stephan', '5', '1900', '2001-01-25 >23:15:16'); >INSERT INTO groupbyTEST VALUES ( 'boris', '3', '2400', '2001-01-25 >23:15:39'); >INSERT INTO groupbyTEST VALUES ( 'boris', '4', '2100', '2001-01-25 >23:15:50'); >INSERT INTO groupbyTEST VALUES ( 'boris', '5', '2300', '2001-01-25 >23:16:01'); >INSERT INTO groupbyTEST VALUES ( 'boris', '6', '200', '2001-01-25 >23:16:11'); > > >A statement like: > >SELECT fldNAME, fldMONTH, sum(fldSALARY) >FROM groupbyTEST >GROUP BY fldNAME >HAVING sum(fldSALARY)>200 > >should cause an error because of the missing fldMONTH in the GROUP BY >clause, >but it is executed without an error and results: > >fldNAME fldMONAT sum(fldGEHALT) >boris 1 10200 >stephan 1 6000 > >... makes not very much sense ... does it?? Sir, why do you think it should cause an error? The statement is valid and the result is correct. Bob Hall Know thyself? Absurd direction! Bubbles bear no introspection. -Khushhal Khan Khatak --------------------------------------------------------------------- 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