-2

このステートメントで構文エラーが発生します。理由はありますか?

私の唯一の推測は、おそらくセッション レコードが選択からロックされているため、同じトランザクションで削除できないということです。しかし、それは構文エラーを引き起こすようには見えません。

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';

何か案は?

4

1 に答える 1

0

insert into ... select .. ステートメントに括弧を使用することはできません。

insert into sessions_history 
      select * 
      from sessions 
      where session_id = 'jjmn6hmuor8mqa2j1vb4gdpno0';
于 2012-12-05T20:08:46.507 に答える