mysql查询数据库重复数据

白玉神驹 / 2023-07-20 / 原文

查询重复领取的优惠券

//查询8888888用户优惠券状态为未使用且数量大于2的用户领取过的优惠券
SELECT discount_coupon_id,count(discount_coupon_id) as c FROM `faith_user_discount_coupon` where user_id='88888888' and `status`='1' GROUP BY discount_coupon_id having c>1