The sum of the

`price`

column is `11.248`

; dividing that by the number of rows (`5`

) gives `2.2496`

, 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:

SQL

SELECT Sum(quantity) As Quantity, Sum(quantity * price) / Sum(quantity) As Price FROM table_name WHERE item_ID = 1;

`SUM(Quantity * Price) / SUM(Quantity)`

2.2496 comes from the avg of the 'Price column'. but it's not the full operation. it's just all prices average.

you have to compute 'Quantity * Price' , before apply AVG()