2
我是新手,laravel和MySQLlaravel子查询,其中和最大值
MySQL查询是
select * from table where id in (select max(id) from table group by thread_id)
我的表是
id thread_id
1 45a7
2 123c
3 45a7
4 d056
5 123c
输出mysql表是
id thread_id
3 45a7
5 123c
4 d056
在这里,我试图把我的MySQL查询laravel如下
MODEL::whereIn('id', function($query){ $query->groupBy('thread_id')})->get();
什么是我做错了吗?下面