How to write this normal query with Laravel query builder?
SELECT `t1`.`id` , `i`.`item_description` AS `name` , SUM( t1.amount ) AS total, `u`.`name` AS `unit`
FROM `fees9_items` AS `t1`
LEFT JOIN `items` AS `i` ON `i`.`id` = `t1`.`item_id`
LEFT JOIN `mesure_units` AS `u` ON `u`.`id` = `i`.`unit`
LEFT JOIN `fees9` AS `f` ON `f`.`id` = `t1`.`fees9_id`
WHERE date >= '2016-01-01' AND (f.field1=1 OR f.field2=1 OR f.other =1)
GROUP BY `i`.`id`
This part is important:
(f.field1=1 OR f.field2=1 OR f.other =1)
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire