我的查询存在以下问题:
Update `visitors-processed` as t1
SET t1.`landedon`="land"
where t1.`Attributes-ip-date-landedon` in
(SELECT distinct t2.`Attributes-ip-date-landedon`
from `visitors-processed` as t2
group by t2.`Attributes-ip-date-landedon`)
它正在给我
错误#1093 - 您无法指定目标表' t1'用于FROM子句中的更新
有什么建议吗?
答案 0 :(得分:0)
答案 1 :(得分:0)
目标表可以放在join子句而不是where子句中:
Update
`visitors-processed` t1
inner join
(select `Attributes-ip-date-landedon`
from `visitors-processed`
group by `Attributes-ip-date-landedon` )t2
On t1.`Attributes-ip-date-landedon`=t2.`Attributes-ip-date-landedon`
SET t1.`landedon`='land'