mysql通过分组条件,取得分个条件中的最后⼀条记录。直接上代码:
1、group_concat
select SUBSTRING_INDEX(group_concat(id order by id desc),',',2) id from content c
where  c.grouperid in (1,2)
GROUP uperid in (1,2);
2、max
select max(id) as id from content where grouperid in (1,2)
mysql group by order bygroup by grouperid
有了id,那么下⾯就好办了, ⾃由发挥。