Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
anushahegde
New Contributor III

Convert qlikview script to SQL query

Hi all,

Could you please help me to convert the below scripting to sql query? This is written in qlikview.

[QVD_NAME_TEMP]:
LOAD
[CID],
[QID],
[AOID],
FROM
tableQ;

inner join([QVD_NAME_TEMP])
Load Distinct [CID]
FROM
tableC
Where [Date]>='01/01/2019' AND [Date]<='01/31/2019';


Left Join([QVD_NAME_TEMP])
LOAD
[AOID],
[AT]
FROM
AOT;

 

Left Join([QVD_NAME_TEMP])
LOAD [CID],
If(Sum(If(([QID]=1000) and ([AOID]=1074),1))>0,1) as Flag01,

If(Sum(If(([QID]=1008) and ([AOID]=1075),1))>0,1) as Flag02
Resident [QVD_NAME_TEMP]
Group By [CID];

 

NoConcatenate
[QVD_NAME_TEMP_2]:
Load Distinct [CID],
[QID],
[AT],
Flag01,
Flag02
Resident [QVD_NAME_TEMP];

drop table [QVD_NAME_TEMP];

NoConcatenate
[SB]:
LOAD 
If(Sum(if(((Flag01=1) and (Match([QID],'1033','1034','1040'))) or ((Flag02=1) and (Match([QID],'1033','1034','1041'))),1,0))>1,1,) as [SC],
[CID]
Resident [QVD_NAME_TEMP_2]
group by [CID];

 

NoConcatenate
[QVD]:
Load [CID],
if(Sum([SC])>=1,1,0) as [SC]
Resident [SB]
group by [CID];

DROP Table [SB];

 

Left Join([QVD])
Load Distinct
Count([QID])as [QCNT],
[CID]
Resident [QVD_NAME_TEMP_2]
Group by [CID];

Left Join([QVD])
Load Distinct
Count([AT])as [AQ],
[CID]
Resident [QVD_NAME_TEMP_2]
where isnull([AT])=0
Group by [CID];

Drop Table [QVD_NAME_TEMP_2];

Regards

Anusha

1 Reply
vireshkolagimat
Contributor III

Re: Convert qlikview script to SQL query

Hi, I suggest first you identify the base tables from where the the data is loaded.

Once you identify the base tables, you can query and try to identify the joins.

Then you might get some ideas to write your own query.

Regards,

VK