summaryrefslogtreecommitdiff
path: root/mysql-test/r/select_found.result
blob: 3a84c3e52da0da384f2580aef43ff8e7ff64e459 (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
drop table if exists t1;
create table t1 (a int not null auto_increment, b int not null, primary key(a));
insert into t1 (b) values (2),(3),(5),(5),(5),(6),(7),(9);
select SQL_CALC_FOUND_ROWS * from t1;
a	b
1	2
2	3
3	5
4	5
5	5
6	6
7	7
8	9
select found_rows();
FOUND_ROWS()
8
select SQL_CALC_FOUND_ROWS * from t1 limit 1;
a	b
1	2
select found_rows();
FOUND_ROWS()
8
select SQL_CALC_FOUND_ROWS * from t1 order by b desc limit 1;
a	b
8	9
select found_rows();
FOUND_ROWS()
8
select SQL_CALC_FOUND_ROWS distinct b from t1 limit 1;
b
2
select found_rows();
FOUND_ROWS()
6
select SQL_CALC_FOUND_ROWS b,count(*) as c from t1 group by b order by c desc limit 1;
b	c
5	3
select found_rows();
FOUND_ROWS()
6
select SQL_CALC_FOUND_ROWS * from t1 left join t1 as t2 on (t1.b=t2.a) limit 2,1;
a	b	a	b
3	5	5	5
select found_rows();
FOUND_ROWS()
8
drop table t1;
create table t1 (a int not null primary key);
insert into t1 values (1),(2),(3),(4),(5);
select sql_calc_found_rows a from t1 where a in (1,2,3) order by a desc limit 0,2;
a
3
2
select FOUND_ROWS();
FOUND_ROWS()
3
select sql_calc_found_rows a from t1 where a in (1,2,3) order by a+2 desc limit 0,2;
a
3
2
select FOUND_ROWS();
FOUND_ROWS()
3
drop table t1;