Mysql SELECT inside UPDATE

前端 未结 4 1807
UPDATE forms SET

pos = (SELECT MIN(pos)-1 FROM forms)

WHERE id=$id

This doesn\'t work, error message:

**You can\'t specify target         


        
4条回答
  •  礼貌的吻别
    2020-12-31 20:35

    I think that you can not use a subquery inside an update statement, but any way there are workarounds for it ...

    Here is a Quotation from the following site:

    "dev.mysql.com"

    “Currently, you cannot delete from a table and select from the same table in a sub-query ”

提交回复
热议问题