Imran Bashir

Imran Bashir

  • NA
  • 186
  • 12.6k

column which have the same id

Jul 30 2016 6:12 AM
i have table name stock .in which 5 column name id productId stockIn stockOut And VoucherType and i want to check the if productId=1 and voucherType=1 that count all the column in stockIn witch the same ProductId and Sum All the value in stockIn then also count in stockout with same product id and sum if the stockin sum is greater then stockout that return true...<br /><br /><br /><br /><br /><br />id ' productid ' stockin 'stockout 'VoucherType<br />-----------------------------------------<br />1 | 1 | 5 | 0 | 1<br />2 | 1 | 5 | 0 | 1 <br />3 | 1 | 5 | 0 | 1 <br />4 | 2 | 5 | 0 | 1 <br />5 | 2 | 0 | 5 | 2 <br />6 | 1 | 0 | 2 | 2 <br />7 | 2 | 0 | 3 | 2 <br /><br />

Answers (3)