Thanks! For the sake of completeness: after carefully rereading the documentation I found a solution to get the values in one query with one resulting row. The documentation says that COUNT counts all *non-NULL* values. When combining the boolean expression with CASEWHEN it is possible to use the COUNT aggregate function:
SELECT COUNT(CASEWHEN((t2-t1) > 1000, 1, null)), COUNT(CASEWHEN((t2-t1) <= 1000, 1, null)), COUNT(*) FROM TEST So I think the original query was not really invalid (in this case the SQL parser should have complained) but it did not match how COUNT works. Uli -- 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 h2-database+unsubscr...@googlegroups.com. To post to this group, send email to h2-database@googlegroups.com. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/groups/opt_out.