mercredi 23 novembre 2016

Convert from RawQuery to Laravel 5 Query

My Query is

select * from amos.equipment_oil
inner join (
    select max(creation_date) as MaxDate
    from amos.equipment_oil
    group by DATE_FORMAT(creation_date, '%m-%d-%Y')
) tm on equipment_oil.creation_date= tm.MaxDate
where equipment_id = $id
order by creation_date asc

I want to convert that to laravel 5 query. Please help. This is what I have so far.

$equipmentOil = EquipmentOil::where('equipment_id', $id)->orderBy('creation_date', 'asc')->get();



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire