a guest Jun 12th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. WITH op as (select point, [date], Inc as sm FROM Income
  2. union all
  3. SELECT point, [date], -Out FROM Outcome)
  4. select point, convert(char(25),[date],103) as [date],
  5. (SELECT SUM(sm) FROM op
  6. WHERE op.[date]<=o1.[date] and op.point=o1.point) as rem
  7. FROM op as o1
  8. GROUP BY point, [date]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand