数据表 t_test

1 取时间最早一条
select * from t_test where aa='a' order by date limit 1
结果:

2 分组去各组最早一条
select * from t_test as t
where t.id in
(
select SUBSTRING_INDEX(GROUP_CONCAT(id ORDER BY `date` ),',',1) from t_test
group by aa
)
结果:

3 补充说明
asc 升序 所有成员最晚第一条数据(默认)
desc 降序 所有成员最新第一条数据