1.数据相同找时间最近的一条
select *
from tableTest w
where not exists (
select 1
from tableTest l
where l.biz_no = w.biz_no
and l.date_created > w.date_created
)
2.group by 之后各组有多少条
SELECT COUNT(*) as num,profession FROM survey_consumer GROUP BY profession
3.group by 之后将不同值拼接起来
select GROUP_CONCAT(s.company_code) from tableTest s group by xxxx
4、查询重复的数据
SELECT COMPANY_CODE, RISK_CODE, CONFIG_CODE, count(*) as counts
FROM T_CFG_VALUE GROUP BY COMPANY_CODE, RISK_CODE, CONFIG_CODE HAVING COUNT(*) = 1