I am using MYSQL, I am using this query:
SELECT students.grade, students.homeroom, orders.meal_quantity, orders.option_choice, orders.drink_choice
FROM orders left join students
on students.id = orders.meal_ordered_for
WHERE `order_for_day` = '2013-04-03'
ORDER BY students.grade, students.homeroom ASC
This gives me the raw data I need, show here:
However, I would like to further organize the data by grouping the results by homeroom and giving totals for quantity, and each option and drink, like this:
Is there a way to do this in one query?