diff options
Diffstat (limited to 'mysql-test/r/win_ntile.result')
-rw-r--r-- | mysql-test/r/win_ntile.result | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/mysql-test/r/win_ntile.result b/mysql-test/r/win_ntile.result index c403e2937e6..41cb1a594bf 100644 --- a/mysql-test/r/win_ntile.result +++ b/mysql-test/r/win_ntile.result @@ -357,4 +357,79 @@ pk a b ntile(20) over (partition by b order by pk) 17 2 20 3 19 4 20 4 20 4 20 5 +select pk, a, b, +ntile(1 + 3) over (partition by b order by pk) +from t1; +pk a b ntile(1 + 3) over (partition by b order by pk) +11 0 10 1 +12 0 10 1 +13 1 10 2 +14 1 10 3 +18 2 10 4 +15 2 20 1 +16 2 20 1 +17 2 20 2 +19 4 20 3 +20 4 20 4 +select pk, a, b, +ntile((select 4)) over (partition by b order by pk) +from t1; +pk a b ntile((select 4)) over (partition by b order by pk) +11 0 10 1 +12 0 10 1 +13 1 10 2 +14 1 10 3 +18 2 10 4 +15 2 20 1 +16 2 20 1 +17 2 20 2 +19 4 20 3 +20 4 20 4 +select t1.a from t1 where pk = 11; +a +0 +select pk, a, b, +ntile((select a from t1 where pk=11)) over (partition by b order by pk) +from t1; +ERROR HY000: Argument of NTILE must be greater than 0 +select t1.a from t1 where pk = 13; +a +1 +select pk, a, b, +ntile((select a from t1 where pk=13)) over (partition by b order by pk) +from t1; +pk a b ntile((select a from t1 where pk=13)) over (partition by b order by pk) +11 0 10 1 +12 0 10 1 +13 1 10 1 +14 1 10 1 +18 2 10 1 +15 2 20 1 +16 2 20 1 +17 2 20 1 +19 4 20 1 +20 4 20 1 +explain +select pk, a, b, +ntile((select a from t1 where pk=13)) over (partition by b order by pk) +from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using temporary +2 SUBQUERY t1 const PRIMARY PRIMARY 4 const 1 +select a from t1; +a +0 +0 +1 +1 +2 +2 +2 +2 +4 +4 +select pk, a, b, +ntile((select a from t1)) over (partition by b order by pk) +from t1; +ERROR 21000: Subquery returns more than 1 row drop table t1; |