Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
psk180590
Creator III
Creator III

How to join data from different tables and compare?

Hello All,

I have some questionnaire data structured as follows:

Table 1
DateEMPID   CIDFIDUID
Table2
Fnumber    FID    UID
Table3
TextTID
Table4
FnumberFID2FIDTID
Table5
MainID

I would like to merge or combine this data into a single table and save in the following manner

FinalTable

Date    EMPID    FNumber    Text

But, there are a few conditions which needs to be considered:

Table2.Fnumber=Table4.FNumber

And Table4.TID=Table3.TID

And Table2.FID=Table4.FID

And Table1.EMPID=Table5.MainID

And Table1.UID=Table2.UID

Can you please suggest what would be the better approach to obtain the result.

TIA!!

1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

psk180590

try as below

LOAD
Date,
EMPID,
  CID,
UID
FROM Table1;
JOIN
LOAD
UID
Fnumber,
FID
FROM Table2;
JOIN
LOAD
FID,
TID
FROM Table4;
JOIN
LOAD
TID,
Text
From Table3
Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

6 Replies
psk180590
Creator III
Creator III
Author

Hello Experts,

stalwar1vinieme12swuehl

Could you please point me the right direction to use in this case. I'm confused between Concatenate and Join.

vinieme12
Champion III
Champion III

psk180590

try as below

LOAD
Date,
EMPID,
  CID,
UID
FROM Table1;
JOIN
LOAD
UID
Fnumber,
FID
FROM Table2;
JOIN
LOAD
FID,
TID
FROM Table4;
JOIN
LOAD
TID,
Text
From Table3
Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
psk180590
Creator III
Creator III
Author

Hello vinieme12

Thanks for the reply and sorry for the delay in getting back.

This looks good, can you also please let me know how do i write my conditions mentioned by following your suggested way?

vinieme12
Champion III
Champion III

this is how your data tables will join; which is based on the conditions specified, i've highlighted the key fields for reference. you don't need to write the conditions separately

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
vinieme12
Champion III
Champion III

we are joining table 1 and table on UID

And Table1.UID=Table2.UID


Table2 to table 4 on FID

And Table2.FID=Table4.FID


and Table 4 to table 3 on TID

And Table4.TID=Table3.TID


these are for Joins not conditions of load

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
psk180590
Creator III
Creator III
Author

Thanks Vineeth,

Your solution works perfectly for me.