group by 函数的使用

select a.product_code, a.oper_id
from t_product_trajectory a
  /* where a.product_code = '123'
  and a.oper_id = '22'*/
group by a.product_code, a.oper_id
having count(a.product_code) > 1 and count(a.oper_id) > 1

select * from t_product_trajectory   这张表是没有主键的。

 

原文地址:https://www.cnblogs.com/dongyaotou/p/12499555.html