查找表中重复两次以上的订单号

select order_id from table_name   group by order_id having count(1)>1

select distinct  pr.order_id  from table_name    pr where exists
(select 1  from table_name    prt where  prt.id !=pr.id  and pr.order_id =prt.order_id )


select distinct  pr.order_id  from table_name pr, table_name pr1 where pr.id !=pr1.id and pr.order_id =pr1.order_id 

posted @ 2022-08-23 16:05  liuhuayiye  阅读(31)  评论(0编辑  收藏  举报