Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Save $300 - Register for QlikWorld (formerly Qonnections) by January 31st: Learn More
Highlighted
neelkapadia
New Contributor II

INNER JOIN IN SQL SCRIPT

Hi,

I have a csv file containing a list of users.

I want to write a query such that it retrieves info only for the users in the csv.

I am trying to write something like:

connections:

SQL

SELECT * FROM (

     SELECT

          A,

          B,

          C

     FROM

          Table1,

          Table2

     WHERE

          conditions..

) a

INNER JOIN (

     SELECT

          X,

          Y

     FROM

          (upload contents of csv file)

) b

ON a.B = b.X;

How do I load the csv file in the script with label SQL?

OR, if I load the csv before the script as follows:

[file]:

LOAD

     @1 as A,

     @2 as B

FROM [file-path]

(txt, codepage is 28591, embedded labels, delimiter is ',', msq);

How do I use the columns A,B in the SQL script?

Thanks!

1 Solution

Accepted Solutions

Re: INNER JOIN IN SQL SCRIPT

Something like this

[file]: 

LOAD Concat(Chr(39) & B & Chr(39), ', ') as ConcatenatedB;

LOAD 

     @1 as A, 

     @2 as

FROM [file-path] 

(txt, codepage is 28591, embedded labels, delimiter is ',', msq);


Let vB = Peek('ConcatenatedB');


Now pass vB to your SQL...

View solution in original post

4 Replies

Re: INNER JOIN IN SQL SCRIPT

May be store the content of field B in a variable and pass it on the SQL query via the variable

neelkapadia
New Contributor II

Re: INNER JOIN IN SQL SCRIPT

Field B has multiple rows. How do I handle that?

Re: INNER JOIN IN SQL SCRIPT

Something like this

[file]: 

LOAD Concat(Chr(39) & B & Chr(39), ', ') as ConcatenatedB;

LOAD 

     @1 as A, 

     @2 as

FROM [file-path] 

(txt, codepage is 28591, embedded labels, delimiter is ',', msq);


Let vB = Peek('ConcatenatedB');


Now pass vB to your SQL...

View solution in original post

neelkapadia
New Contributor II

Re: INNER JOIN IN SQL SCRIPT

Thank you so much!