In my case statement, I'm using 0 if the value is NULL. Now I want to replace 0 with N/A. I've tried using ISNULL and COALESCE but its not working.
Below is my code.
SELECT BOM.STYLE_ID, BOM.SEASON_ID, SUM(CASE WHEN BOM.Ad_compo_desc LIKE UPPER('%emb%') THEN 1 ELSE ISNULL(0, 'N/A') END) AS EMBRO, SUM(CASE WHEN BOM.Ad_compo_desc LIKE UPPER('%print%') THEN 1 ELSE ISNULL(0, 'N/A') END) AS PRINTING FROM IPLEXSTY_AD_BOM_DTL BOM WHERE CONTENT_CLASS = 'ART' GROUP BY BOM.STYLE_ID, BOM.SEASON_ID;
ISNULL(0, 'N/A')will always return0because0is never null? Do you perhaps meanisnull(BOM.Ad_compo_desc,'n/a')?sumstatement around yourcase statement- you can't sum'n/a'- so that is going to break even if you get theisnullworking.