I have to write a query which seem to be bit too complicated to me.
I have order\_products table with these sample records:

```
| ORDER_PRODUCTS_ID(auto)  | PRODUCT_ID    | PRICE | QUANTITY
| 1                        | 2             | 100   | 2
| 2                        | 2             | 100   | 3
| 3                        | 2             | 50    | 1
| 4                        | 3             | 200   | 4
| 5                        | 3             | 200   | 2

```

I need a query for rapport where I can have summary of all most often purchased products group by products ids and prices (because one product can have different prices in each order as you see on the example)
I need results to be like this:

```
PRODUCT_ID | QUANTITY_SUM | PRICE      | TOTAL SUM PRICE
3          | 6            | 200        | 400
2          | 5            | 100        | 200
2          | 1            | 50         | 50

```

Im trying with a query like:

```
select price, product_id, SUM(quantity) as quantity_sum ,
  price*quantity_sum as total_sum_price from dr_orders_products
   group by product_id , price order by quantity_sum desc

```

but i gives me error: 'quantity\_sum is unknown column'.
was trying also something like this:

```
select price, product_id, SUM(quantity) as quantity_sum ,
      price*(select SUM(quantity) from dr_orders_products where product_id =product_id ans price = price  ) as total_sum_price from dr_orders_products
       group by product_id , price order by quantity_sum desc

```

but the results are some worng higher values.
I will really appreciate any help on this