Data:
Final result I intend to obtain is i.e, a new column 'payOff' has to be added and set to 'Y' when ss_use_TYPE='delta'
Any suggestions please ?
CodePudding user response:
One approach uses aggregation:
SELECT SUM(Sum) AS Sum, ss_source, case_id,
CASE WHEN COUNT(CASE WHEN ss_use_type = 'delta' THEN 1 END) > 0
THEN 'Y' ELSE 'N' END AS payoff
FROM yourTable
GROUP BY ss_source, case_id;