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

Keeping the table structure in SQL Join

Hello,

i could never find an answer to this:

If I use an SQL Select statement with joins QlikView creates only one table for all the selected fields.

Is there any way to keep the multi table structure from my SQL server in QlikView ?


Thanks and Greetings

HansUnbenannt.png

7 Replies
maxgro
MVP
MVP

don't join in SQL

makes 2 load in qlik, each one from a sql table

T1:

load *;

SQL select * from table1;

T2:

load *;

SQL select * from table2;

Not applicable
Author

Thanks, but will the data still be related (joined) ?

For example in the Movies database FilmCountryID and CountryID need to be joined. From the names I don't see how QlikView could join both IDs.

So the data would be useless. Do I first have to rename all related columns in SQL ? That would be inconvenient.

Not applicable
Author

Rename the fields during the QV load statement

Load

CountryID As NewFieldname

;

Sql select........

you need the two ID's to match in your end application for QV to join them

Joe

jonathandienst
Partner - Champion III
Partner - Champion III

The QV data model works very differently than a SQL database and you will often have a data model that is differently structured than the source data.

The way an associative data model works is that associations are made by using the same field name in both tables. If there are multiple fields in common, then QV will create a composite key (aka synthetic key). So yes, you may need to alias the column names during loading to get related fields to associate and prevent unrelated fields with the same name from associating. No need to change the names in SQL.

HTH

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Hey Hans Lauer,

I understand your problem, Even I have faced the same issue.

But QV Data model works differently, it does the join based on the column names.

So in order to have both the tables in your qlikview document, you should load it twice and rename the fields in either one of the table.

Thanks

Ganesh

maxgro
MVP
MVP

yes you have to rename the field (or fields, depends)  to associate the 2 tables

Not applicable
Author

Thanks for all the answers, the solution was quite obvious, I somehow made things unnecessarily complicated...

This also explains why the "select" button for SQL tables only allows one table at a time.