Browse Source

Window functions + ORDER BY : first testcase

pull/216/head
Sergei Petrunia 10 years ago
parent
commit
6533bd1b74
  1. 26
      mysql-test/r/win_orderby.result
  2. 32
      mysql-test/t/win_orderby.test

26
mysql-test/r/win_orderby.result

@ -0,0 +1,26 @@
drop table if exists t0,t1;
create table t0(a int primary key);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(
pk int,
a int,
key(pk)
);
insert into t1
select
A.a + B.a* 10 + C.a * 100,
1
from t0 A, t0 B, t0 C;
select
pk,
count(a) over (order by pk rows between 2 preceding and 2 following)
from t1
where pk between 1 and 30
order by pk desc
limit 4;
pk count(a) over (order by pk rows between 2 preceding and 2 following)
30 3
29 4
28 5
27 5
drop table t0,t1;

32
mysql-test/t/win_orderby.test

@ -0,0 +1,32 @@
#
# Tests for window functions and ORDER BY
#
--disable_warnings
drop table if exists t0,t1;
--enable_warnings
create table t0(a int primary key);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(
pk int,
a int,
key(pk)
);
insert into t1
select
A.a + B.a* 10 + C.a * 100,
1
from t0 A, t0 B, t0 C;
select
pk,
count(a) over (order by pk rows between 2 preceding and 2 following)
from t1
where pk between 1 and 30
order by pk desc
limit 4;
drop table t0,t1;
Loading…
Cancel
Save