0
如何使用Laravel查詢構建器編寫此常規查詢?將常規查詢更改爲Laravel查詢構建器
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`
這部分是非常重要的:
(f.field1=1 OR f.field2=1 OR f.other =1)
謝謝它幫我解決這個問題。 –