Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Partner - Specialist
Partner - Specialist

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.

View solution in original post

2 Replies
chriscammers
Partner - Specialist
Partner - Specialist

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
Author

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