gpt4 book ai didi

MySql 从多列选择中删除?

转载 作者:行者123 更新时间:2023-11-29 11:29:39 26 4
gpt4 key购买 nike

以下内容

delete from child N
where parent_id in
(select parent_id , count(*) c
from parent
group by other_attribute having c > 1 )

可以理解的返回

Operand should contain 1 column(s)

如何解决这个问题?

最佳答案

您不需要在子查询中选择计数。只需在 HAVING 子句中显式使用计数即可:

delete from child N
where parent_id in
(
select parent_id
from parent
group by other_attribute
having count(*) > 1
)

关于MySql 从多列选择中删除?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37630248/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com