Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
vsmejkal
Contributor II
Contributor II

How to filter out specific rows - Load QVD with a referenced condition

Dear all

Please could you help me re-write the following SQL into a Qlik Load syntax? The trouble I cannot connect to the database directly so I cannot use the SQL as it is. I only have a QVD available. The idea is to filter-out specific rows.

SQL(Working well):

SELECT

UserName,

Path,

AccessType,

SecurityGroupName


   FROM server.schema.DB_table FUA1

   WHERE NOT EXISTS

      (

      SELECT

      *

         FROM server.schema.DB_table

         WHERE UserName = FUA1.UserName AND Path = FUA1.Path

      )



My wrong attempt No.1(Error: UserName not found):

[A_All]:

Load

   UserName AS A_UserName,

   Path AS A_Path,

   AccessType AS A_AccessType,

   SecurityGroupName AS A_SecurityGroupName

      FROM [lib://Connection_L1/DB_table.qvd](qvd);

   

[B_Sub]:

Load

   UserName,

   Path,

   AccessType,

   SecurityGroupName

      Resident [A_All]

         WHERE UserName = A_UserName;



My wrong attempt No.2 (Not working altogether - wrong sub load syntax I'd have thought)

[A_All]:

Load

UserName AS A_UserName,

   Path AS A_Path,

   AccessType AS A_AccessType,

   SecurityGroupName AS A_SecurityGroupName

      FROM [lib://Connection_L1/DB_table.qvd](qvd);


     Where Not Exists(

        (Load

           *

           FROM [lib://Connection_L1/DB_table.qvd](qvd);

         )

      )


Thank you, VJ

10 Replies
Lauri
Specialist
Specialist

Don't be fooled by the row count that the data load log shows you. It processed 4 955 850 rows, but that doesn't mean that's what ended up in the table. Did you look at the actual number of rows after it finished?


Removing SecurityGroupName from the Group By *should* result in fewer rows (if users can have multiple different values for SecurityGroupName), so that makes sense to me.


But at the end of the day, sometimes SQL is the way to go... just make note of the performance differences between Qlik and your SQL program. In some queries, Qlik can be MUCH faster.