Jump to content

SELECT DISTINCT but get the sum of another column


deansatch

Recommended Posts

I have a table where there are multiple rows per order_number. Each row has a column for price and quantity.

 

I want to show a summary e.g.

order no: 123, qty: 55, total price: £2222

order no: 454, qty: 65, total price: £2652

etc....

 

If I use SELECT DISTINCT I can get the rows as one order number per row, but how can I add the price/quantities for each order instead of just getting the single values for these columns?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.