i have the following query
select * from (SELECT accident.id,count(*) as cnt from accident left join driver on driver.accident_id = accident.id group by accident.id)alias where cnt = 1
and this is my query builder
$accidents = DB::table('accident')
->leftjoin('driver','accident.id','driver.accident_id')
->select(DB::raw('accident.*,count(*) as jumlah_kendaraan'))->groupBy('accident.id')
->where('jumlah_kendaraan', $jumlah_kendaraan);
i tried to convert it like the above but i got an error says
SQLSTATE[42703]: Undefined column: 7 ERROR: column "jumlah_kendaraan" does not exist
can anyone help me to solve it? thanks in advance
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2CJeBJc
via IFTTT
Aucun commentaire:
Enregistrer un commentaire