Thomas,
Ok, but behaviour is not consistent. Please look carefully at the following 
example:

1. Prepare initial data
CREATE MEMORY TABLE IF NOT EXISTS TABLE_123(account_id BIGINT, time BIGINT) 
NOT PERSISTENT
INSERT INTO TABLE_123 (account_id,time) VALUES (10,2)
INSERT INTO TABLE_123 (account_id,time) VALUES (10,2)

2. run query where alias 'time' is the same as column name
SELECT account_id, COUNT(time) as time FROM TABLE_123 GROUP BY account_id 
HAVING time=2 
OK. Treats 'time' as column name and returns [{account_id=10, time=2}]

3. insert one more row
INSERT INTO TABLE_123 (account_id,time) VALUES (10,3)

4. Run query from step #2.
SELECT account_id, COUNT(time) as time FROM TABLE_123 GROUP BY account_id 
HAVING time=2 
FAIL. Column """time""" must be in the GROUP BY list; SQL statement 
[90016-187]


a) its not clear why #4 failed but #2 was ok. If h2 supports alias the same 
as column name then both query should be successfull, otherwise they both 
should fail
b) Error description is step#4 is not helpful and correct. If I add 'time' 
to GROUP BY, query still fails.
c) Please add documentation about H2 support of column aliases in "HAVING"

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].
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.

Reply via email to