方法一:
思路:使用group by分组,再用count计算每组的个数,最后用having比较计算后的值大于1的数据。
select PRODUCT_CODE from TM_CIS_REQ_PRD_HIS_COUNT group by PRODUCT_CODE,CREDIT_ORG_CODE,REQ_DATE having count(REQ_DATE)>1
方法二:
思路:使用group by分组,再用count计算每组的个数,放到临时表dd中,最后用where筛选出大于1的
select PRODUCT_CODE from (select count(REQ_DATE) as product from TM_CIS_REQ_PRD_HIS_COUNT group by PRODUCT_CODE,CREDIT_ORG_CODE,REQ_DATE) as dd where product>1;
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/106317.html原文链接:https://javaforall.cn