MySQL的临时表不能用在复合语句中

来源:互联网 发布:博士国家电网北京知乎 编辑:程序博客网 时间:2024/05/21 06:11

MySQL的临时表不能用在复合语句中

 

如:

drop table if exists tmp_Table2;
create temporary table tmp_Table2 (Id int(10) not null auto_increment primary key, field1 varchar(100));

delete tmp_Table2 as A from tmp_Table2 as A, (select *, MIN(Id) from tmp_Table2 group by field1 having count(*) > 1) as B where A.field1 = B.field1 and A.Id > B.Id

 

tmp_Table2是临时表,上边的用法行不通。

原创粉丝点击