Using Oracle 8i:
I need to summarize total sales by employee. Each invoice can have multiple items sold.
sales1 table contents:
employee, invoice, qty, price
smith, 5055, 2, 200
smith, 5055, 2, 50
smith, 5056, 1, 310
smith, 5058, 1, 438
jones, 5047, 1, 400
jones, 5047, 2, 125
richie, 5098, 1, 435
richie, 5099, 1, 230
SELECT employee, invoice, sum(qty * price) as ext_price FROM sales1;
employee, invoice, ext_price
smith 5055 500
smith 5056 310
smith 5058 438
jones 5047 650
richie 5098 435
richie 5099 230
I would like to then have it summarize the total sales per employee and then divide that by the invoice count for the average sales per employee. So, this would be the expected final output.
employee count sum ave
smith 3 1248 416
jones 1 650 650
richie 2 665 333
How can I make this happen in one SELECT statement? Is that possible?
-Hallux
I need to summarize total sales by employee. Each invoice can have multiple items sold.
sales1 table contents:
employee, invoice, qty, price
smith, 5055, 2, 200
smith, 5055, 2, 50
smith, 5056, 1, 310
smith, 5058, 1, 438
jones, 5047, 1, 400
jones, 5047, 2, 125
richie, 5098, 1, 435
richie, 5099, 1, 230
SELECT employee, invoice, sum(qty * price) as ext_price FROM sales1;
employee, invoice, ext_price
smith 5055 500
smith 5056 310
smith 5058 438
jones 5047 650
richie 5098 435
richie 5099 230
I would like to then have it summarize the total sales per employee and then divide that by the invoice count for the average sales per employee. So, this would be the expected final output.
employee count sum ave
smith 3 1248 416
jones 1 650 650
richie 2 665 333
How can I make this happen in one SELECT statement? Is that possible?
-Hallux