Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
anushahegde
Contributor III
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

Labels (2)
1 Reply
vireshkolagimat
Creator III
Creator III

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