Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
karan_kn
Creator II
Creator II

Convert SQL to QlikView Script

Please help me to convert this SQL query to QlikView script.

select count(1)

from [AAM].[dbo].metadata1 as a,

[AAM].[dbo].metadata2 as b

where

a.asset_folder=b.asset_folder

and (a.o_type='doc1' or (a.o_type='doc2' and a.path not like '%/division/%'))

and (a.inactive_date='' or a.inactive_date is null or try_parse(a.inactive_date as date)> getutcdate())

2 Replies
Siva_Sankar
Master II
Master II

If the sql returns data..why cant you try preceding load..

Load *;

sql select count(1)

from [AAM].[dbo].metadata1 as a,

[AAM].[dbo].metadata2 as b

where

a.asset_folder=b.asset_folder

and (a.o_type='doc1' or (a.o_type='doc2' and a.path not like '%/division/%'))

and (a.inactive_date='' or a.inactive_date is null or try_parse(a.inactive_date as date)> getutcdate());

-Siva

sasiparupudi1
Master III
Master III

Something like below

a:

Load *

Resident metadata1

Where

Match(o_type,'doc1','doc2') and WildMatch(path,'*division*')=0

And (Len(Trim(inactive_date))=0 Or inactive_date>UTC())

;

inner join(a)

Load

asset_folder

Resident metadata2

;

CountRecords:

Load Count(asset_folder) as Count

Resident a

;

if you want the count in a variable, try as below

Let vCount=Peek('Count',0,'CountRecords');

hth