# scalar having query I select 42 having 42 > 18 ---- 42 # scalar having query I select 42 having 42 > 801 ---- statement ok CREATE TABLE test (x INT, y INT); statement ok INSERT INTO test VALUES (1, 2), (2, 2), (11, 22) query II select y as b, sum(x) as sum from test group by b having b = 2 ---- 2 3 query II select count(x) as a, y as b from test group by b having a > 1 ---- 2 2 query II select count(x) as a, y + 1 as b from test group by b having b + 1 = 24; ---- 1 23 query II select x from test group by x having max(y) = 22 ---- 11 query II select y + 1 as i from test group by y + 1 having count(x) > 1 and y + 1 = 3 or y + 1 = 23 order by i; ---- 3 23 statement error select count(x) from test group by count(x)