Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WITH op as (select point, [date], Inc as sm FROM Income
- union all
- SELECT point, [date], -Out FROM Outcome)
- select point, convert(char(25),[date],103) as [date],
- (SELECT SUM(sm) FROM op
- WHERE op.[date]<=o1.[date] and op.point=o1.point) as rem
- FROM op as o1
- GROUP BY point, [date]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement