大家好我在mysql中有这个原始查询我需要翻译成laravel 5.4查询构建器
select * from pages where (phase_id, type) in (select max(phase_id),type from pages where phase_id<=2 and actived=1 group by type) and actived=1
我不知道如何在查询构建器中转换where claumule with 2 colum
任何想法?
全部
答案 0 :(得分:1)
$results = DB::select(
select * from pages where (phase_id, type)
in (
select max(phase_id), type
from pages
where phase_id <= 2
and actived = 1
group by type
)
and actived = 1
);