Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
vvvvvvizard
Partner - Specialist
Partner - Specialist

Simple Table joins

My first table has column A ,B C and Date column

Second table has column A Z E and Date

Should i let the tables join only on the column "Date" ? Or both Date and A ?   I was told joining tables on Date column is bad practice , not sure if this is true .

1 Solution

Accepted Solutions
its_anandrjs

See the uniqueness it both this table is best practice other wise you have to use both

Ex:-

FirstTable:

Load A as FirstA ,B C, Date as FirstDate  A&Date as Key from Location;

Join

Secondtable:

Load  A as SecondA,Z, E, Date as SecondDate, A&Date as Key From Location;

Regards

Anand

View solution in original post

8 Replies
ashfaq_haseeb
Champion III
Champion III

Hi,

What does does both table contain.

Join on field instead?

In this case A and rename Date field in second table?

Hope it helps

Regards

ASHFAQ

its_anandrjs

See the uniqueness it both this table is best practice other wise you have to use both

Ex:-

FirstTable:

Load A as FirstA ,B C, Date as FirstDate  A&Date as Key from Location;

Join

Secondtable:

Load  A as SecondA,Z, E, Date as SecondDate, A&Date as Key From Location;

Regards

Anand

maleksafa
Specialist
Specialist

it depends on your data model, if the link should be on combination Date and column A or just A, because you will end up with different results based on the join fields, but regarding the Date column if this is QlikView Date which is number based you will not have any problem with that and it is not a bad practice.

alexandros17
Partner - Champion III
Partner - Champion III

It depend on your data structure, what is column A? If it is a primary key you should use that column, if your dates represent different information (Eg. invoice date and Order Date) it will not be a good idea joining tables on date field.

Hope it helps

vvvvvvizard
Partner - Specialist
Partner - Specialist
Author

If i join on A only and i select a value in column A and choose a date eg September , how will qlikview know to show me column Z and E date only for date September from that table , i assume it will show me column Z and E for all the months ?

vvvvvvizard
Partner - Specialist
Partner - Specialist
Author

If i join on date from my understanding it should work .

If i join on combination of A and Date it should also work .

If i hoin on A only ,  i think this wont work .

Which is the better option ?

alexandros17
Partner - Champion III
Partner - Champion III

Then Yusuf:

Join works on fields that have the same name so join on A, Date or their combination works but this is not the only condition because Join must logically link two or more tables according to a logic. The logic is given always (following DB logic) from primary Key, that is the field or fields that univocally identify records. Sometimes we do not have this information so we need other rules. Probably even if your tables have the same field A this field do not has the same kind of information so it do not work. If the only other field that can link the tables is Date then the only solution is using it for the join

sakamsureshbabu
Creator
Creator

add