diff --git a/test/test_475/model.bin b/test/test_475/model.bin new file mode 100644 index 0000000000..66019b4320 --- /dev/null +++ b/test/test_475/model.bin @@ -0,0 +1 @@ +a:1:{i:0;a:10:{i:0;a:2:{s:8:"sphinxql";s:31:"CREATE TABLE t (grp INT, v INT)";s:14:"total_affected";i:0;}i:1;a:2:{s:8:"sphinxql";s:65:"INSERT INTO t VALUES (1,1,10),(2,1,20),(3,2,5),(4,2,5),(5,3,100)";s:14:"total_affected";i:5;}i:2;a:3:{s:8:"sphinxql";s:43:"SELECT grp, SUM(v) AS s FROM t GROUP BY grp";s:10:"total_rows";i:3;s:4:"rows";a:3:{i:0;a:2:{s:3:"grp";s:1:"1";s:1:"s";s:2:"30";}i:1;a:2:{s:3:"grp";s:1:"2";s:1:"s";s:2:"10";}i:2;a:2:{s:3:"grp";s:1:"3";s:1:"s";s:3:"100";}}}i:3;a:3:{s:8:"sphinxql";s:57:"SELECT grp, SUM(v) AS s FROM t GROUP BY grp HAVING s > 20";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:2:{s:3:"grp";s:1:"1";s:1:"s";s:2:"30";}i:1;a:2:{s:3:"grp";s:1:"3";s:1:"s";s:3:"100";}}}i:4;a:3:{s:8:"sphinxql";s:9:"SHOW META";s:10:"total_rows";i:4;s:4:"rows";a:3:{i:0;a:2:{s:13:"Variable_name";s:5:"total";s:5:"Value";s:1:"2";}i:1;a:2:{s:13:"Variable_name";s:11:"total_found";s:5:"Value";s:1:"2";}i:2;a:2:{s:13:"Variable_name";s:14:"total_relation";s:5:"Value";s:2:"eq";}}}i:5;a:2:{s:8:"sphinxql";s:12:"DROP TABLE t";s:14:"total_affected";i:0;}i:6;a:2:{s:8:"sphinxql";s:28:"create table t(a int, b int)";s:14:"total_affected";i:0;}i:7;a:2:{s:8:"sphinxql";s:27:"insert into t values(0,1,2)";s:14:"total_affected";i:1;}i:8;a:3:{s:8:"sphinxql";s:73:"select a, count(*) from t where a=1 or b=2 group by a having count(*) = 1";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:2:{s:1:"a";s:1:"1";s:8:"count(*)";s:1:"1";}}}i:9;a:2:{s:8:"sphinxql";s:12:"drop table t";s:14:"total_affected";i:0;}}} \ No newline at end of file diff --git a/test/test_475/test.xml b/test/test_475/test.xml new file mode 100644 index 0000000000..697c319dd8 --- /dev/null +++ b/test/test_475/test.xml @@ -0,0 +1,37 @@ + + + +HAVING vs total_found + + + + + + + + +searchd +{ + + data_dir = +} + + + + +CREATE TABLE t (grp INT, v INT); +INSERT INTO t VALUES (1,1,10),(2,1,20),(3,2,5),(4,2,5),(5,3,100); +SELECT grp, SUM(v) AS s FROM t GROUP BY grp; +SELECT grp, SUM(v) AS s FROM t GROUP BY grp HAVING s > 20; +SHOW META; +DROP TABLE t; + + +create table t(a int, b int); +insert into t values(0,1,2); +select a, count(*) from t where a=1 or b=2 group by a having count(*) = 1; +drop table t; + + + + \ No newline at end of file