Forum Moderators: open
1. customers: list of customers, indexed by an id, fields: usual personal stuff
2. orders: list of all orders made, indexed by a order_id,
fields: key to customer who made the order
i want to do a query on the table orders that gives me a ranking list of the customer who ordered the most and the total number that the customer ordered.
Thanks.
Not clear whether by "most" you mean number of items, or value - if value, replace SUM(O.quantity) with SUM (O.value) as appropriate.