復(fù)制代碼 代碼如下:
create table tmp selete col from table group by xx;
delete from table where col not in (select col from tmp);
drop table tmp;
我們需要把這部分臟數(shù)據(jù)刪除到,在刪除的過程中我寫的delete sql語句不能執(zhí)行不知道為什么,可以同樣的語句執(zhí)行
select 是沒有問題的
如:
delete from student a where a.id in (1,2);()
select a.* from student a where a.id in (1,2);()
這是什么原因了呢?
結(jié)果處理:
delete 在寫操作一張表的時(shí)候 不用別名操作成功!
如:
delete from student where id in (1,2);()
我使用mysql版本:5.1.30-community-log
這是在開發(fā)中遇到的一個(gè)小問題,積累起來。
新聞熱點(diǎn)
疑難解答
圖片精選