数据库指定时间内重复数据查询

-- 查询重复数据
select qr_code,created_at,station_by from t_product_data where flag = 0  and qr_code in(
    select qr_code from t_product_data t 
    where flag = 0
    -- 时间不唯一并且码数据一致的情况  说明是重复数据
    and t.created_at not in(
    select MAX(created_at)from t_product_data tt where tt.qr_code = t.qr_code and flag =0
    )
)
order by qr_code
posted @ 2024-06-07 09:58  Journey&Flower  阅读(10)  评论(0)    收藏  举报