Hi, Your example works with H2 (unfortunately), but this one fails (it throws an exception):
drop table table_test; CREATE TABLE TABLE_TEST(account_id BIGINT, time BIGINT); INSERT INTO TABLE_TEST (account_id,time) VALUES (10,2); INSERT INTO TABLE_TEST (account_id,time) VALUES (10,3); SELECT account_id, time FROM TABLE_TEST HAVING account_id=10; It also fails with PostgreSQL, and SQLite, and Apache Derby, and HSQLDB. So: nope, this will not be supported in H2. Regards, Thomas On Wednesday, October 21, 2015, Taras Fedkiv <[email protected]> wrote: > Hi, > > H2(v1.4.190) throws error if HAVING is used without GROUP BY. > Ex: > CREATE MEMORY TABLE IF NOT EXISTS TABLE_TEST(account_id BIGINT, time > BIGINT) NOT PERSISTENT > INSERT INTO TABLE_TEST (account_id,time) VALUES (10,2) > SELECT account_id, time FROM TABLE_TEST HAVING account_id=10 //throws > org.h2.jdbc.JdbcSQLException: Column """account_id""" must be in the GROUP > BY list; > > Please add support of HAVING without GROUP BY. MySQL, PostgreSQL support > this feature. > > Thank you, > Taras > > > The information in this message may be confidential. It is intended > solely for > the addressee(s). If you are not the intended recipient, any disclosure, > copying or distribution of the message, or any action or omission taken by > you > in reliance on it, is prohibited and may be unlawful. Please immediately > contact the sender if you have received this message in error. > > -- > 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] > <javascript:_e(%7B%7D,'cvml','h2-database%[email protected]');> > . > To post to this group, send email to [email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');>. > Visit this group at http://groups.google.com/group/h2-database. > For more options, visit https://groups.google.com/d/optout. > -- 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.
