简体   繁体   中英

subquery in update fails MYSQL

I already tried looking at some threads but i can't hardly make my QUERY work.

here is the error message

#1093 - You can't specify target table 'tblUser' for update in FROM clause


UPDATE tblUser 
SET logId = (
    SELECT CONCAT((
        SELECT logId FROM tblUser 
        WHERE resultId = '2014-02-11 21:31:35'),'45') 
    from tblUser)  
WHERE rulesId = '14' 

Thanks in advance

You can't read and write to the same table if you're using a transactional storage engine. The reason is simple, the table is locked for writing from your UPDATE clause.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM