Debian Codegraph @

mysql-test/suite/ndbcluster/group_by_order.test

raw
1 --source include/have_ndb.inc
2
3 # Turn off ndb_join_pushdown
4 --disable_query_log
5 set @save_ndb_join_pushdown = @@session.ndb_join_pushdown;
6 set ndb_join_pushdown = false;
7 --enable_query_log
8
9 create table t1
10 (
11 a int, b varchar(30),
12 primary key(a)
13 ) engine = NDB;
14
15 insert into t1 values (1,'one');
16 insert into t1 values (2,'two');
17 insert into t1 values (3,'three');
18 insert into t1 values (4,'four');
19
20 --echo #
21 --echo # Group by query 1
22 --echo # - group by
23 --echo #
24 --sorted_result
25 select sum(a), 'b' from t1 where a > 0
26 and b is not null group by substr(b,2)
27 having sum(a) <> 2 ;
28
29 --echo #
30 --echo # Group by query 2
31 --echo # - union + group by
32 --sorted_result
33 select sum(a) + 200 as the_sum, 'City 1' as the_town from t1
34 group by b
35 union distinct
36 select sum(a) + 200, 'City 2' from t1
37 group by b ;
38
39 drop table t1;
40
41 # Restore original ndb_join_pushdown value
42 --disable_query_log
43 set ndb_join_pushdown = @save_ndb_join_pushdown;
44 --enable_query_log