mysql中You can't specify target table for update in FROM clause錯誤的意思是說,不能先select出同一表中的某些值,再update這個表(在同一語句中)。 例以下面這個sql:mysql
delete from hr_uc_user where
(name, code) in (
select
name n,
code cc
from
hr_uc_user
group by name,code
having
count(*) > 1)
)sql
改爲以下:spa
delete from hr_uc_user wherecode
(name, code) in (
select w.n,w.cc from
(select
name n,
code cc
from
hr_uc_user
group by name,code
having
count(*) > 1) w
) ci