summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/engines/funcs/r/fu_aggregate_max_subquery.result
blob: 5f913985a6a0dc7e73fe7f8171a54f982be270ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(c1 VARCHAR(10), c2 VARCHAR(10), c3 TINYINT);
INSERT INTO t1 VALUES ('a','b',0), ('a','b',1), ('a','b',2), ('a','b',3), ('a','b',4), ('a','b',5), ('a','b',6), ('a','b',7), ('a','b',8), ('a','b',9);
SELECT c1,c2,c3 FROM t1 ORDER BY c3 DESC LIMIT 1;
c1	c2	c3
a	b	9
SELECT c1,MAX(c3) FROM t1 GROUP BY c1;
c1	MAX(c3)
a	9
SELECT c1,c2,c3 FROM t1 WHERE c3=(SELECT MAX(c3) FROM t1);
c1	c2	c3
a	b	9
SELECT c1,c2,c3 FROM t1 WHERE c3=(SELECT MAX(t11.c3) FROM t1 AS t11 WHERE t1.c1 = t11.c1);
c1	c2	c3
a	b	9
DROP TABLE t1;
CREATE TABLE t1(c1 VARCHAR(10), c2 VARCHAR(10), c3 SMALLINT);
INSERT INTO t1 VALUES ('a','b',0), ('a','b',1), ('a','b',2), ('a','b',3), ('a','b',4), ('a','b',5), ('a','b',6), ('a','b',7), ('a','b',8), ('a','b',9);
SELECT c1,c2,c3 FROM t1 ORDER BY c3 DESC LIMIT 1;
c1	c2	c3
a	b	9
SELECT c1,MAX(c3) FROM t1 GROUP BY c1;
c1	MAX(c3)
a	9
SELECT c1,c2,c3 FROM t1 WHERE c3=(SELECT MAX(c3) FROM t1);
c1	c2	c3
a	b	9
SELECT c1,c2,c3 FROM t1 WHERE c3=(SELECT MAX(t11.c3) FROM t1 AS t11 WHERE t1.c1 = t11.c1);
c1	c2	c3
a	b	9
DROP TABLE t1;
CREATE TABLE t1(c1 VARCHAR(10), c2 VARCHAR(10), c3 MEDIUMINT);
INSERT INTO t1 VALUES ('a','b',0), ('a','b',1), ('a','b',2), ('a','b',3), ('a','b',4), ('a','b',5), ('a','b',6), ('a','b',7), ('a','b',8), ('a','b',9);
SELECT c1,c2,c3 FROM t1 ORDER BY c3 DESC LIMIT 1;
c1	c2	c3
a	b	9
SELECT c1,MAX(c3) FROM t1 GROUP BY c1;
c1	MAX(c3)
a	9
SELECT c1,c2,c3 FROM t1 WHERE c3=(SELECT MAX(c3) FROM t1);
c1	c2	c3
a	b	9
SELECT c1,c2,c3 FROM t1 WHERE c3=(SELECT MAX(t11.c3) FROM t1 AS t11 WHERE t1.c1 = t11.c1);
c1	c2	c3
a	b	9
DROP TABLE t1;
CREATE TABLE t1(c1 VARCHAR(10), c2 VARCHAR(10), c3 INT);
INSERT INTO t1 VALUES ('a','b',0), ('a','b',1), ('a','b',2), ('a','b',3), ('a','b',4), ('a','b',5), ('a','b',6), ('a','b',7), ('a','b',8), ('a','b',9);
SELECT c1,c2,c3 FROM t1 ORDER BY c3 DESC LIMIT 1;
c1	c2	c3
a	b	9
SELECT c1,MAX(c3) FROM t1 GROUP BY c1;
c1	MAX(c3)
a	9
SELECT c1,c2,c3 FROM t1 WHERE c3=(SELECT MAX(c3) FROM t1);
c1	c2	c3
a	b	9
SELECT c1,c2,c3 FROM t1 WHERE c3=(SELECT MAX(t11.c3) FROM t1 AS t11 WHERE t1.c1 = t11.c1);
c1	c2	c3
a	b	9
DROP TABLE t1;
CREATE TABLE t1(c1 VARCHAR(10), c2 VARCHAR(10), c3 INTEGER);
INSERT INTO t1 VALUES ('a','b',0), ('a','b',1), ('a','b',2), ('a','b',3), ('a','b',4), ('a','b',5), ('a','b',6), ('a','b',7), ('a','b',8), ('a','b',9);
SELECT c1,c2,c3 FROM t1 ORDER BY c3 DESC LIMIT 1;
c1	c2	c3
a	b	9
SELECT c1,MAX(c3) FROM t1 GROUP BY c1;
c1	MAX(c3)
a	9
SELECT c1,c2,c3 FROM t1 WHERE c3=(SELECT MAX(c3) FROM t1);
c1	c2	c3
a	b	9
SELECT c1,c2,c3 FROM t1 WHERE c3=(SELECT MAX(t11.c3) FROM t1 AS t11 WHERE t1.c1 = t11.c1);
c1	c2	c3
a	b	9
DROP TABLE t1;
CREATE TABLE t1(c1 VARCHAR(10), c2 VARCHAR(10), c3 BIGINT);
INSERT INTO t1 VALUES ('a','b',0), ('a','b',1), ('a','b',2), ('a','b',3), ('a','b',4), ('a','b',5), ('a','b',6), ('a','b',7), ('a','b',8), ('a','b',9);
SELECT c1,c2,c3 FROM t1 ORDER BY c3 DESC LIMIT 1;
c1	c2	c3
a	b	9
SELECT c1,MAX(c3) FROM t1 GROUP BY c1;
c1	MAX(c3)
a	9
SELECT c1,c2,c3 FROM t1 WHERE c3=(SELECT MAX(c3) FROM t1);
c1	c2	c3
a	b	9
SELECT c1,c2,c3 FROM t1 WHERE c3=(SELECT MAX(t11.c3) FROM t1 AS t11 WHERE t1.c1 = t11.c1);
c1	c2	c3
a	b	9
DROP TABLE t1;