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: 
Not applicable

Many to one table join

Hi,

I’m looking to combine 2 tables  together Consumption and Site.

The id that I want to combine them with is MPRN however Site will only contain one instance of each MPRN value whereas Consumption will have many.

Example:

Consumption


MPRN

Consumption

Date

123

80

01/01/2015

123

90

01/12/2014

356

100

01/12/2014

Site


MPRN

Name

Active

123

ABC

Y


To be merged into:


MPRN

Name

Active

Consumption

Date

123

ABC

Y

80

01/01/2015

123

ABC

Y

90

01/12/2014

Does anyone know how to achieve this?

Any help is much appreciated.


1 Solution

Accepted Solutions
vikasmahajan

PFA uses Right join

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.

View solution in original post

5 Replies
PrashantSangle

Hi,

Simple Left join or join will work for you.

Or

Simply load both table due to association relation is created between Consumption and Site

Then use Stright table and those field.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
vikasmahajan

PFA uses Right join

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
Anonymous
Not applicable
Author

Hi Ashley,

Try below code:

Consumption:
Load * inline
[
MPRN,Consumption,Date
123,80,01/01/2015
123,90,01/12/2014
356,100,01/12/2014
]
;

Site:
Load * inline
[
MPRN,Name,Active
123,ABC,Y
]
;

NoConcatenate

SiteConsumption:
LOAD *
Resident Site;

left Join

LOAD *
Resident Consumption;

drop table Consumption;
drop table Site;

Site.png

Regards

Neetha

its_anandrjs

Hi,

Do simple Right join and why not do only right join rather than load resident tables because it increase the load time as well.

Ex:-

Consumption:
Load * inline
[
MPRN,Consumption,Date
123,80,01/01/2015
123,90,01/12/2014
356,100,01/12/2014
]
;

Site:
Right Join

Load * inline
[
MPRN,Name,Active
123,ABC,Y
]
;

RENAME Table Consumption to FinalTable;


Tabop.png

Regards

Anand

Not applicable
Author

Thanks for the help everyone - right join worked.  The reason it wasn't working correcting was because the MPRN field on Site had whitespace before the value!