I have this data:
name qty date flag
---------------------------------------------
abc 255 11/10/1986 12:00:00 AM IN
abc 300 11/10/2010 12:00:00 AM IN
abc 12 11/10/2012 12:00:00 AM OUT
abc 13 11/9/2010 12:00:00 AM OUT
NULL NULL NULL NULL
I want to get sum of qty
at that specific row:
- If
flag
is "in", then it will add to the sum - if
flag
is "out", then it will subtract from the sum