~posulliv/drizzle/memcached_applier

« back to all changes in this revision

Viewing changes to tests/r/subselect_no_opts.result

Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
618
618
0       10
619
619
1       11
620
620
drop table t1, t2;
621
 
#multi-delete with subselects
622
 
create table t11 (a int NOT NULL, b int, primary key (a));
623
 
create table t12 (a int NOT NULL, b int, primary key (a));
624
 
create temporary table t2 (a int NOT NULL, b int, primary key (a)) ENGINE=MyISAM;
625
 
insert into t11 values (0, 10),(1, 11),(2, 12);
626
 
insert into t12 values (33, 10),(22, 11),(2, 12);
627
 
insert into t2 values (1, 21),(2, 12),(3, 23);
628
 
select * from t11;
629
 
a       b
630
 
0       10
631
 
1       11
632
 
2       12
633
 
select * from t12;
634
 
a       b
635
 
2       12
636
 
22      11
637
 
33      10
638
 
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
639
 
ERROR HY000: You can't specify target table 't12' for update in FROM clause
640
 
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
641
 
ERROR 21000: Subquery returns more than 1 row
642
 
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
643
 
select * from t11;
644
 
a       b
645
 
0       10
646
 
1       11
647
 
select * from t12;
648
 
a       b
649
 
22      11
650
 
33      10
651
 
drop table t11, t12, t2;
652
621
#insert with subselects
653
622
CREATE TABLE t1 (x int);
654
623
create table t2 (a int);
1164
1133
3
1165
1134
drop table t1;
1166
1135
#
1167
 
# Multi update test
1168
 
#
1169
 
CREATE TABLE t1 (
1170
 
id int default NULL
1171
 
);
1172
 
INSERT INTO t1 VALUES (1),(1),(2),(2),(1),(3);
1173
 
CREATE TEMPORARY TABLE t2 (
1174
 
id int default NULL,
1175
 
name varchar(15) default NULL
1176
 
) ENGINE=MyISAM;
1177
 
INSERT INTO t2 VALUES (4,'vita'), (1,'vita'), (2,'vita'), (1,'vita');
1178
 
update t1, t2 set t2.name='lenka' where t2.id in (select id from t1);
1179
 
select * from t2;
1180
 
id      name
1181
 
4       vita
1182
 
1       lenka
1183
 
2       lenka
1184
 
1       lenka
1185
 
drop table t1,t2;
1186
 
#
1187
1136
# correct NULL in <CONSTANT> IN (SELECT ...)
1188
1137
#
1189
1138
create temporary table t1 (a int, unique index indexa (a)) ENGINE=MyISAM;