问题
Hi all i have this raw query in mysql i need to translate to laravel 5.4 query builder
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
i don't know how to convert in query builder where clausule with 2 colum
any ideas?
Thx all
回答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
);
来源:https://stackoverflow.com/questions/42574418/how-to-convert-mysql-to-laravel-query-builder