如何使用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)
答案 0 :(得分:1)
试一试,它应该有用
a = float(input())
if a > 0:
y = a - 12
else:
y = a
print(y)