The result is correct, and is precisely what you asked for.
The sum of the
; dividing that by the number of rows (
, which is the result you are getting.
The only way to get your expected value is to take the average price per item
. To do that, you need to sum the product of the quantity and price, and divide by the sum of the quantity:
SELECT Sum(quantity) As Quantity, Sum(quantity * price) / Sum(quantity) As Price FROM table_name WHERE item_ID = 1;