Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Nested "Select" on a table during a Load

Hi All,

I have a question on loading a table. I want one of the columns to be the result of another nested Load. I know how to do this in SQL, but I'm not sure what the equivalent is in the QV script.

For example:

If I have tableA and tableB, the SQL may look like:

SELECT tableA.field1, tableA.field2, (SELECT tableB.field1 FROM tableB WHERE tableB.field2 = '1')

FROM table A

What's a good way to do it in QV's syntax, assuming tableB is already loaded as a Resident? Is a nested Load even possible?

Thanks in advance!

1 Solution

Accepted Solutions
chriscammers
Contributor III

Nested "Select" on a table during a Load

The example that you've given is basically a left join between table a and b (except you don't have any correlating conditions between table A and B) Your options are pretty simple load records from Table A and then Join the rows from table b.

something like this...

TableC:

Load

Field1,

Field2

From TableA

Left Join(TableC)

Load

Field1 as Field3

from TableB

Where Field2 = '1'

without a mathcing field between the two queries you will end up with a cartesian product so if there is a matching field or "join conditoin" you should use renaming so the names match and Qlikview will automatically join based on the matching fields.

2 Replies
chriscammers
Contributor III

Nested "Select" on a table during a Load

The example that you've given is basically a left join between table a and b (except you don't have any correlating conditions between table A and B) Your options are pretty simple load records from Table A and then Join the rows from table b.

something like this...

TableC:

Load

Field1,

Field2

From TableA

Left Join(TableC)

Load

Field1 as Field3

from TableB

Where Field2 = '1'

without a mathcing field between the two queries you will end up with a cartesian product so if there is a matching field or "join conditoin" you should use renaming so the names match and Qlikview will automatically join based on the matching fields.

Not applicable

Nested "Select" on a table during a Load

Ah I should've seen this. Thank you for the help!

Community Browser