1. 程式人生 > >MySQL Error Code:1093,Error Code:1248

MySQL Error Code:1093,Error Code:1248

Error Code:1093 是在執行DELETE或者UPDATE時含有子查詢導致的。

You can't specify target table 'USER' from update in FROM clause

如:

UPDATE user SET usex = 4 WHERE

uage>(SELECT AVG(uage) FROM user);

可修改為:

UPDATE user SET usex = 4 WHERE

uage>(SELECT avg_uage FROM (SELECT AVG(uage) AS avg_uage FROM user) AS tmpuser

);

Error Code:1248:

如果不在子查詢後加別名AS tmpuser會報1248錯誤。