Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
1655653
Contributor II
Contributor II

Add two association in the same pair of tables

Hi, i have 2 tables composed as follows

1 SoftwareHouse

  • name
  • website
  • id 

2 Release

  • date
  • ..
  • videogame_name
  • developer_key
  • publisher_key

Now i need to add two association because the one is on id-developer_key, and the other should be id-publisher_key.

How can i do?

thanks in advance

Labels (3)
1 Solution

Accepted Solutions
chrismarlow
Specialist II
Specialist II

Hi,

Something like;

Release:
Load * Inline [
videogame_id, videogame_name, developer_key, publisher_key
VID1, Game 1, 1, 1
VID2, Game 2, 1, 2
];

SoftwareHouse:
Load * Inline [
name, website, id
XXX, YYY, 1
AAA, BBB, 2
];

Link:
Load 
	'Developer' as role,
	developer_key AS id,
    videogame_id
Resident Release;

Concatenate(Link)
Load 
	'Publisher' as role,
	publisher_key AS id,
    videogame_id
Resident Release;

DROP FIELDS developer_key, publisher_key;

Cheers,

Chris.

View solution in original post

4 Replies
chrismarlow
Specialist II
Specialist II

Hi,

I think it depends what you then want to do.

So you could simply have 2 copies of your software house data aliasing your fields, so for developer;

name as developer_name
website as developer_website
id as developer_key

& similar for publisher.

This would be good for some things, but if you need to be able associate on an either/or basis I think you would need a link table set up.

Cheers,

Chris.

1655653
Contributor II
Contributor II
Author

Thanks, how could i do a link table set up?

chrismarlow
Specialist II
Specialist II

Hi,

Something like;

Release:
Load * Inline [
videogame_id, videogame_name, developer_key, publisher_key
VID1, Game 1, 1, 1
VID2, Game 2, 1, 2
];

SoftwareHouse:
Load * Inline [
name, website, id
XXX, YYY, 1
AAA, BBB, 2
];

Link:
Load 
	'Developer' as role,
	developer_key AS id,
    videogame_id
Resident Release;

Concatenate(Link)
Load 
	'Publisher' as role,
	publisher_key AS id,
    videogame_id
Resident Release;

DROP FIELDS developer_key, publisher_key;

Cheers,

Chris.

1655653
Contributor II
Contributor II
Author

Thank you! 

Attach the screenshot of my result. Thanks again