mysql如何查询两个字段存在两条以上的相同数据?

求救,比如我想查找所以 zxtId,billUuid,这两个字段存在 个以上重复的数据,要怎么查询呢?

select *  from wx_material  group by zxtId,billUuid  having count(zxtId + billUuid) > 1

这样只显示的其中 1 条,我想要重复的所有
比如

id   zxtId     billUuid   add
1    123       A009       0309号
2    123       A009       0310号
3    126       A011       0315号
4    126       A011       0322号
阅读 2.5k
3 个回答
头像
眸撼
    17
    新疆乌鲁木齐市
    ✓ 已被采纳
    SELECT
        b.* 
    FROM
        app_duty_sign_in_range b,
        ( SELECT location, latitude FROM app_duty_sign_in_range GROUP BY location, latitude HAVING count( location + "" + latitude ) > 1 ) AS a 
    WHERE
        a.location = b.location 
        AND a.latitude = b.latitude

    类似这种,外面套一层select

    新手上路,请多包涵

    SELECT *
    FROM
    wx_material
    WHERE zxtId IN
    (select zxtId from wx_material group by zxtId,billUuid having count(zxtId) > 1)

    撰写回答
    你尚未登录,登录后可以
    • 和开发者交流问题的细节
    • 关注并接收问题和回答的更新提醒
    • 参与内容的编辑和改进,让解决方法与时俱进
    推荐问题