I have a table where each row is an order for various items. The columns are unit_type, date_ordered, and quantity_ordered. The problem I'm having is this: I need to create a page that (hopefully) will display the total count for each unit_type by adding their quantities. To complicate things, the quantity_ordered requires the use of decimals. Any ideas?
Provided quantity_ordered is a number type(int, decimal, float), you can just add them up and group in the SQL
SELECT unit_type, sum(quantity_ordered) FROM table GROUP BY unit_type