Hi just wondering if it is possible to combine two columns into one to remove duplicate lines of data.
SELECT
events.name,
name.name2,
events.Effect_dt,
events.Comments,
events.Rate,
CASE WHEN events.Comments = 'RATE SET' THEN 0 ELSE events.Amount END as Amount,
sum(
CASE WHEN events.Comments <> 'RATE SET' THEN - events.Amount ELSE 0 END
) over(
partition by events.name
order by
events.Effect_dt
) as Rolled_Amount
FROM
events events
left join .deals deals on events.name = deals.name
left join .name name2 on deals.name = name.thekey
WHERE
events.comments not in ('INTEREST CALC')
and events.effect_dt >= '2024-01-01'
and events.effect_dt <= '2024-01-31'
and events.name = 'James'