The database has two fields in the wrong position, you want to change them. Because there is no database write permission, it needs to be implemented with SQL statements. Originally thought to be simple
Update table A set a. Field a= (select B field from table where id=?), set a. Field b= (Select a field from table where id=?) where id=? , and the results reported this problem.
You can ' t specify target table ' Wms_cabinet_form ' for update in FROM clause
Google later found that it is the problem of MySQL itself, it is necessary to write:
Update table SET field a= (select T1. field b from (SELECT * from table where id=?) T1), set field b= (Selet t2. Field A from (SELECT * from table where id=?) T2) where id=?
For your own example:
UPDATE Ec_payment_type
SET Return_url = (
SELECT
A.notify_url
From
(
SELECT
*
From
Ec_payment_type
WHERE
payment_type_id = 10
) A
),
Notify_url = (
SELECT
B.return_url
From
(
SELECT
*
From
Ec_payment_type
WHERE
payment_type_id = 10
) b
)
WHERE
payment_type_id = 10
MySQL Update SQL error: You can ' t specify target table ' Wms_cabinet_form ' for update in FROM clause