直接上代码:
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 BY c.grouperid in (1,2);
2、max
select max(id) as id from content where grouperid in (1,2) group by grouperid
有了id,那么下面就好办了, *发挥。