mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge gleb.loc:/home/uchum/work/bk/5.0-opt
into gleb.loc:/home/uchum/work/bk/5.1-opt mysql-test/r/having.result: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/having.test: Auto merged sql/field.cc: Auto merged sql/sql_select.cc: Auto merged mysql-test/include/mix1.inc: Merge with 5.0-opt. mysql-test/r/create.result: Merge with 5.0-opt. mysql-test/r/innodb_mysql.result: Merge with 5.0-opt. mysql-test/r/type_enum.result: Merge with 5.0-opt. mysql-test/t/type_enum.test: Merge with 5.0-opt. sql/filesort.cc: Merge with 5.0-opt. sql/sql_base.cc: Merge with 5.0-opt. sql/table.cc: Merge with 5.0-opt. storage/innobase/handler/ha_innodb.cc: Merge with 5.0-opt.
This commit is contained in:
@ -158,6 +158,25 @@ EXPLAIN SELECT 0 AS x, a FROM t1 GROUP BY x,a HAVING x=1 AND a > 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
|
||||
DROP table t1;
|
||||
CREATE TABLE t1 (a int PRIMARY KEY);
|
||||
CREATE TABLE t2 (b int PRIMARY KEY, a int);
|
||||
CREATE TABLE t3 (b int, flag int);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t2 VALUES (1,1), (2,1), (3,1);
|
||||
INSERT INTO t3(b,flag) VALUES (2, 1);
|
||||
SELECT t1.a
|
||||
FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
|
||||
GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
|
||||
a
|
||||
SELECT DISTINCT t1.a, MAX(t3.flag)
|
||||
FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
|
||||
GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
|
||||
a MAX(t3.flag)
|
||||
SELECT DISTINCT t1.a
|
||||
FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
|
||||
GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
|
||||
a
|
||||
DROP TABLE t1,t2,t3;
|
||||
create table t1 (col1 int, col2 varchar(5), col_t1 int);
|
||||
create table t2 (col1 int, col2 varchar(5), col_t2 int);
|
||||
create table t3 (col1 int, col2 varchar(5), col_t3 int);
|
||||
|
Reference in New Issue
Block a user