Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

arctushar's avatar

Complex db query

Hi I have column Header as below

item | price| quantity | buysell

Now I want query result as below

  1. What is the sum of price*quantity based on Item based on buy
  2. What is the sum of price*quantity based on Item based on sell
  3. What is the sum of price*quantity based on item
  4. What is the sum of pricequantity of buy - sum of pricequantity of sell based on item

is it possible? plz help

0 likes
1 reply

Please or to participate in this conversation.