Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts,
I have a requirement where I have to convert an SQL code into equivalent qlik script.
SQL script:
select a12.MONTH_ID MONTH_ID,
sum(case when a11.PROD_ID in (N’0276’, N’0218’)then a11.BEN_ANP else null end ) WJXBFS1,
(case when max((case when a11.PROD_ID in (N’0276’, N’0281’, N’H213, N’H215) then 1 else 0 end ))=1
then count (distinct ( case when a11.PROD_CD in (N’0276’, N’0281’, N’H213, N’H215) then a11.POL_NO else null end)) else null end) WJXBFS2
FRom(select snapshot_period, pol_no, prod_cd, ben_anp from table_1 where pol_no in (select unique(pol_no) from table_1 where prod_cd in (‘0276’, ‘0281’, ‘H213’, ‘H215’))) a11,
table_2 a12
where a12.snapshot_period= a12.date
and ( a11.Prod_cd in (N’0276’, N’0281) or a11.prod_cd in (N’0276, N’0281’, N’H213, N’H215))
group by a12.MONTH_ID;
we don’t have connection stings to load the same sql code. We have access only to qvds.
please help in this. Thanks in adavance
Hi,
You can use this functions and use joins as usual in SQL.
case | If |
in (N’0276’, N’0218’) | Wildmatch(N’0276’, N’0218’) |
null | len(trim(Field))>0 , or Is NULL |