偷学了一波黑科技
对下述这个表,想要抽取出不同cityid、shopid对应的最早/最晚开店的记录
即想抽出第3、5、7条
设数据库名为rec
select * from (select * from rec order by opentime desc) as a group by a.cityid,a.shopid;
select * from (select * from rec order by opentime asc) as a group by a.cityid,a.shopid
select * from (select * from rec order by opentime asc) as a group by a.cityid,a.shopid