diff options
Diffstat (limited to 'mysql-test/r/distinct.result')
-rw-r--r-- | mysql-test/r/distinct.result | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index 1fbda27f5da..6a06a9661aa 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -608,6 +608,65 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a; a a DROP TABLE t1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (id INT NOT NULL, fruit_id INT NOT NULL, fruit_name varchar(20) +default NULL); +INSERT INTO t1 VALUES (1,1,'ORANGE'); +INSERT INTO t1 VALUES (2,2,'APPLE'); +INSERT INTO t1 VALUES (3,2,'APPLE'); +INSERT INTO t1 VALUES (4,3,'PEAR'); +SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name = +'APPLE'; +SELECT @v1, @v2; +@v1 @v2 +2 APPLE +SELECT DISTINCT fruit_id, fruit_name INTO @v3, @v4 FROM t1 GROUP BY fruit_id, +fruit_name HAVING fruit_name = 'APPLE'; +SELECT @v3, @v4; +@v3 @v4 +2 APPLE +SELECT DISTINCT @v5:= fruit_id, @v6:= fruit_name INTO @v7, @v8 FROM t1 WHERE +fruit_name = 'APPLE'; +SELECT @v5, @v6, @v7, @v8; +@v5 @v6 @v7 @v8 +3 PEAR 3 PEAR +SELECT DISTINCT @v5 + fruit_id, CONCAT(@v6, fruit_name) INTO @v9, @v10 FROM t1 +WHERE fruit_name = 'APPLE'; +SELECT @v5, @v6, @v7, @v8, @v9, @v10; +@v5 @v6 @v7 @v8 @v9 @v10 +3 PEAR 3 PEAR 5 PEARAPPLE +SELECT DISTINCT @v11:= @v5 + fruit_id, @v12:= CONCAT(@v6, fruit_name) INTO +@v13, @v14 FROM t1 WHERE fruit_name = 'APPLE'; +SELECT @v11, @v12, @v13, @v14; +@v11 @v12 @v13 @v14 +6 PEARPEAR 6 PEARPEAR +SELECT DISTINCT @v13, @v14 INTO @v15, @v16 FROM t1 WHERE fruit_name = 'APPLE'; +SELECT @v15, @v16; +@v15 @v16 +6 PEARPEAR +SELECT DISTINCT 2 + 2, 'Bob' INTO @v17, @v18 FROM t1 WHERE fruit_name = +'APPLE'; +SELECT @v17, @v18; +@v17 @v18 +4 Bob +DROP TABLE IF EXISTS t2; +CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20) +default NULL); +SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE +'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE'; +LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2; +SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE +'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE'; +LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2; +SELECT @v19, @v20; +@v19 @v20 +2 APPLE +SELECT * FROM t2; +fruit_id fruit_name +2 APPLE +2 APPLE +DROP TABLE t1; +DROP TABLE t2; CREATE TABLE t1 (a CHAR(1)); INSERT INTO t1 VALUES('A'), (0); SELECT a FROM t1 WHERE a=0; |