Skip to Content
0
Nov 16, 2020 at 09:34 AM

SAP HANA- GETTING ONLY THE NOT NULL RESULTS FROM CASE WHEN IN SELECT

39 Views Last edit Nov 16, 2020 at 09:35 AM 2 rev

Dear team,

I want to get only the results that are not NULL from my query

how can I do that?

select case when "U_XIS_NewUsed" = 'M'

then

(select T3."U_Company"

from OITM T1

inner join "@XIS_MDLS" T2 on T1."U_XIS_SrvMdl" = T2."Code"

INNER JOIN "@XIS_MFCTCD" T3 ON T2."U_Mnfctr" = T3."Code"

inner join QUT1 T4 ON T1."ItemCode"=T4."ItemCode"

where T4."DocEntry"=729--:list_of_cols_val_tab_del

AND T1."ItemCode" =T4."ItemCode")

when (T1."ItmsGrpCod" = '102' and T1."QryGroup20" = 'Y') or (T1."ItmsGrpCod" = '103' and T1."QryGroup22" = 'Y') then 'Ofer'

when T1."ItmsGrpCod" = '102' and T1."QryGroup21" = 'Y'

then 'Avnir'

--else ''

end as "Company"

from OITM T1

INNER JOIN QUT1 T2 ON T1."ItemCode"=T2."ItemCode"

WHERE T2."DocEntry"=729 -------:list_of_cols_val_tab_del

AND T1."ItemCode"=T2."ItemCode"


The results:results.png

Thank you,

Or Cohen

Attachments

results.png (1.8 kB)