【问题标题】:Get total count using group by having count > 1通过 count > 1 使用 group 获取总计数
【发布时间】:2023-03-28 22:40:01
【问题描述】:

我正在寻找桌子上猫图案上的多个点。

select spot_pattern, count(*) from cat_pattern group by spot_pattern having count(*) > 1;

这行得通吗?

【问题讨论】:

    标签: sql oracle


    【解决方案1】:

    您是否要获取此信息?

    select * from temp_new_template_pattern 
    where vin_pattern in (
    select vin_pattern
    from temp_new_template_pattern 
    group by vin_pattern 
    having count(*) > 1)
    

    【讨论】:

    • 我很高兴它起作用了,但从问题来看,我认为想要的结果是“我发现总共 8 个重复项”或“是的,有重复项”。 (尽管您可以通过更改上面的“外部”SELECT 来获得这些结果。)
    • 我尽量不让问题变得混乱。我确实找到了 8 个,但我需要它们而不是每个 2 个。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-22
    • 1970-01-01
    • 2017-11-04
    • 1970-01-01
    • 2017-01-10
    相关资源
    最近更新 更多