Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to join 2 tables

Hi Guys

I need help to join 2 tables

Table1:

Load

Vehicle

Date

Table2

Vehicle

Date

But the format in Table 1 is a Vehicle ID

and in Table 2 its Vehicle ID and OwnerID as Vehicle (done by Server Admin)

so data in Table 1 looks like this

1234          1/1/2015

and table 2 its

1_1234          1/1/2015

I want the end result to join these 2 tables and show as table 2 so all table 1 links on Vehicle but also shows OwnerID with Vehicle.

Both Tables have same Vehicle data.

Thanks

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

Vehicles:

LOAD

     Vehicle AS Vehicle_ID,

     Date AS VehicleDate

FROM

     xxxxxx;

Owners:

LOAD

     SubField( Vehicle , '_' , 2 ) AS Vehicle_ID,

     SubField( Vehicle , '_' , 1 ) AS Owner,

     Date AS OwnerDate

FROM

     yyyyyy;

Will make a connection (key) between the two tables on the Vehicle_ID - effectively working as a join in the Associate Database of QlikView without joining...

View solution in original post

6 Replies
petter
Partner - Champion III
Partner - Champion III

Vehicles:

LOAD

     Vehicle AS Vehicle_ID,

     Date AS VehicleDate

FROM

     xxxxxx;

Owners:

LOAD

     SubField( Vehicle , '_' , 2 ) AS Vehicle_ID,

     SubField( Vehicle , '_' , 1 ) AS Owner,

     Date AS OwnerDate

FROM

     yyyyyy;

Will make a connection (key) between the two tables on the Vehicle_ID - effectively working as a join in the Associate Database of QlikView without joining...

sunny_talwar

Does owner ID and vehicle are always linked to each other with a underscore between them?

Anonymous
Not applicable
Author

Yes They are.

sunny_talwar

Than what Petter‌ has provided should work for you well.

Anonymous
Not applicable
Author

Hi Petter

Not sure, but can i get this

SubField( Vehicle , '_' , 1 ) AS Owner,


to then be added to table 1?

What i wanted was

Vehicles:

LOAD

     Owner and Vehicle AS Vehicle_ID,

     Date AS VehicleDate

FROM

     xxxxxx;

Anonymous
Not applicable
Author

Sorry, just tested this and all is working properly!!!

Thanks Petter