【MySQL】去重
时间:2021-07-01 10:21:17
帮助过:17人阅读
FROM xxx
WHERE id
NOT in(
SELECT tmp.id
FROM(
SELECT id,
COUNT(id)
AS cnt
FROM xxx
GROUP BY ticket_id,ota_id
HAVING cnt
>1)tmp
UNION ALL
SELECT tmp2.id
FROM (
SELECT id,
COUNT(id)
AS cnt
FROM xxx
GROUP BY ticket_id,ota_id
HAVING cnt
=1)tmp2)
【MySQL】去重
标签:去重 sel blog xxx from union style logs _id