t_table:
order_num other
1 a
2 b
3 c
1 d
2 e
1 f
统计重复出现的订单有多少条(上面例子应该是两条,分别为订单号1和订单号2)
select count(1) from (select count(*) as cnt , order_num from t_table group by order_num)t1 where t1.cnt>1
写sql的时候千万小心输入法,别输入中文字符了,比如中文括号,肉眼看不出来,报错的话很难找原因。