mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
for multy-delete command used same algorithm of table reference (alias)
This commit is contained in:
@ -244,7 +244,7 @@ select * from t2;
|
|||||||
n d
|
n d
|
||||||
1 30
|
1 30
|
||||||
1 30
|
1 30
|
||||||
DELETE t1, t2 FROM t1 a,t2 b where a.n=b.n;
|
DELETE a, b FROM t1 a,t2 b where a.n=b.n;
|
||||||
select * from t1;
|
select * from t1;
|
||||||
n d
|
n d
|
||||||
3 2
|
3 2
|
||||||
|
@ -158,7 +158,7 @@ insert into t1 (F1,F2,F3,cnt,groupid) values ('0','0','0',1,6),
|
|||||||
('0','1','2',1,5), ('0','2','0',1,3), ('1','0','1',1,2),
|
('0','1','2',1,5), ('0','2','0',1,3), ('1','0','1',1,2),
|
||||||
('1','2','1',1,1), ('1','2','2',1,1), ('2','0','1',2,4),
|
('1','2','1',1,1), ('1','2','2',1,1), ('2','0','1',2,4),
|
||||||
('2','2','0',1,7);
|
('2','2','0',1,7);
|
||||||
delete from t1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3);
|
delete from m1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3);
|
||||||
select * from t1;
|
select * from t1;
|
||||||
F1 F2 F3 cnt groupid
|
F1 F2 F3 cnt groupid
|
||||||
0 0 0 1 6
|
0 0 0 1 6
|
||||||
|
@ -218,7 +218,7 @@ select * from t2;
|
|||||||
UPDATE t1 a ,t2 b SET a.d=b.d,b.d=30 WHERE a.n=b.n;
|
UPDATE t1 a ,t2 b SET a.d=b.d,b.d=30 WHERE a.n=b.n;
|
||||||
select * from t1;
|
select * from t1;
|
||||||
select * from t2;
|
select * from t2;
|
||||||
DELETE t1, t2 FROM t1 a,t2 b where a.n=b.n;
|
DELETE a, b FROM t1 a,t2 b where a.n=b.n;
|
||||||
select * from t1;
|
select * from t1;
|
||||||
select * from t2;
|
select * from t2;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
@ -126,6 +126,6 @@ insert into t1 (F1,F2,F3,cnt,groupid) values ('0','0','0',1,6),
|
|||||||
('1','2','1',1,1), ('1','2','2',1,1), ('2','0','1',2,4),
|
('1','2','1',1,1), ('1','2','2',1,1), ('2','0','1',2,4),
|
||||||
('2','2','0',1,7);
|
('2','2','0',1,7);
|
||||||
|
|
||||||
delete from t1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3);
|
delete from m1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3);
|
||||||
select * from t1;
|
select * from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -2665,8 +2665,7 @@ mysql_execute_command(THD *thd)
|
|||||||
TABLE_LIST *walk;
|
TABLE_LIST *walk;
|
||||||
for (walk= (TABLE_LIST*) tables; walk; walk= walk->next)
|
for (walk= (TABLE_LIST*) tables; walk; walk= walk->next)
|
||||||
{
|
{
|
||||||
if ((!strcmp(auxi->real_name,walk->real_name) ||
|
if (!strcmp(auxi->real_name, walk->alias) &&
|
||||||
!strcmp(auxi->real_name,walk->alias)) &&
|
|
||||||
!strcmp(walk->db, auxi->db))
|
!strcmp(walk->db, auxi->db))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user