mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
Merge 'Fix incorrect handling of OR clauses in HAVING' from Jussi Saurio
thanks to @pedrocarlo for reminding me we have this old-ass bug I never bothered to fix Closes #1708
This commit is contained in:
commit
4794b022a5
2 changed files with 19 additions and 2 deletions
|
@ -206,4 +206,19 @@ do_execsql_test distinct_agg_functions {
|
|||
limit 3;
|
||||
} {Aaron|1769|33|53.6060606060606
|
||||
Abigail|833|15|55.5333333333333
|
||||
Adam|1517|30|50.5666666666667}
|
||||
Adam|1517|30|50.5666666666667}
|
||||
|
||||
do_execsql_test_on_specific_db {:memory:} having_or {
|
||||
CREATE TABLE users (first_name TEXT, age INTEGER);
|
||||
INSERT INTO users VALUES
|
||||
('Michael', 25), ('Michael', 50),
|
||||
('David', 50),
|
||||
('Sarah', 65);
|
||||
|
||||
select first_name, count(*) as cnt, avg(age) as avg_age
|
||||
from users
|
||||
group by first_name
|
||||
having cnt = 2 or avg_age = 65
|
||||
order by cnt desc
|
||||
} {Michael|2|37.5
|
||||
Sarah|1|65.0}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue