我在這個語句中得到一個語法錯誤。任何想法爲什麼?這條SQL語句有什麼問題?在同一個事務中選擇並刪除
我唯一的猜測是會話記錄可能已經被鎖定,因此無法在同一個事務中刪除。但是,這似乎並不會導致語法錯誤。
insert into sessions_history
select *
from sessions
where session_id = 'jjmn6hmuor8mqa2j1vb4gdpno0';
delete from sessions
where session_id = 'jjmn6hmuor8mqa2j1vb4gdpno0';
和這裏的錯誤:
錯誤編號:1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delete from sessions where session_id = 'vk744qiebkfr0el7tesi65us04'' at line 1
insert into sessions_history select * from sessions where session_id = 'vk744qiebkfr0el7tesi65us04'; delete from sessions where session_id = 'vk744qiebkfr0el7tesi65us04';
任何想法?
你實際得到了什麼錯誤? –
你可以顯示你正在收到的錯誤嗎? – Ibu
你對兩個表有相同的模式嗎? – Smit