12 lines
506 B
SQL
12 lines
506 B
SQL
select sum(qty), supplier_product_num, package_qty, package_cost, (round(sum(qty) / package_qty + 0.49) * package_cost) as cost
|
|
from hotlunch_order_items, hotlunch_menu_products, supplier_products
|
|
where hotlunch_order_items.school_num = 16
|
|
and schedule_num = 1337
|
|
and hotlunch_menu_products.school_num = 16
|
|
and hotlunch_menu_products.menu_item_num = hotlunch_order_items.menu_item_num
|
|
and supplier_products.school_num = 16
|
|
and supplier_products.record_num = supplier_product_num
|
|
group by 2,3,4
|
|
order by 3
|
|
|