I agree with Taras here - I've been bitten by the same behaviour. But this topic's title is misleading; it not because of the HAVING keyword and it is not because of the column alias.
Fundamentally, depending on the data in the table, sometimes you can include a column in the select clause that is not in the group by clause. Here is a simple repro : create table foobar (col1 int, col2 int); insert into foobar (col1, col2) values (1, 2); -- this time the select works select col1, col2 from foobar group by col1; insert into foobar (col1, col2) values (1, 3); -- this time the select fails select col1, col2 from foobar group by col1; Output: Column "COL2" must be in the GROUP BY list; SQL statement: select col1, col2 from foobar group by col1 [90016-176] On Friday, 28 August 2015 10:37:49 UTC+2, Taras Fedkiv wrote: > > Hi Thomas, > Could you please answer the questions from previous email? > My API allows clients to enter SELECT queries which are executed on H2 db. > Thats why logical H2 behaviur is very important. > > I look forward to your reply, > Taras > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
