今天在写以下SQL的UPDATE语句时,出现一个比较怪异的问题“You can't specify target table '****' for update in FROM clause”;
只需要在SELECT外面再嵌套一层即可解决,如下所示:
DELETE from rpt_chooser_individual_performance_total WHERE id not in (select id from
(select id from
rpt_chooser_individual_performance_total
group by site_id,product_no )a)
在尝试使用UPDATE语句时遇到了一个特定的错误:Youcantspecifytargettable****forupdateinFROMclause。文章提供了一个解决方案,即通过在外层添加一个DELETE语句,并使用嵌套的SELECT子句来解决这个问题。这种方法涉及到了对rpt_chooser_individual_performance_total表的行进行筛选,依据是site_id和product_no的分组。

8591

被折叠的 条评论
为什么被折叠?



