Hi,
I'm making a simple online booking system using mysql and PHP where people can book out equipment.
There is a limited number of bookable items (10 camcorders, 20 laptops etc). When someone books an item, some of the data stored is the item id (which references the equipment table) and the number booked.
After a simple query for the equipemnt booked an a certain day at a certain time, the table looks like this:
Code:
item_id number_booked
1 4
4 10
4 5
2 6
1 6
4 8
What I need is a table that shows DISTINCT item_id's and the SUM of the number booked for each of these items. So the resulting table would be:
Code:
item_id total
1 12
4 23
2 6
Hope I've explained it clearly. Could someone give me a hand?
Cheers