Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to join two tables

Hi.

I have two tables which I would like to join into one.

Table 1

Item: name:

1 a

2 b

3 c

4 d

5 e

Table 2

Item: name:

6 f

7 g

I would like to have tabe 2 included in table one

Table 1

Item: name:

1 a

2 b

3 c

4 d

5 e

6 f

7 g

Can someone please help me?

Regards

Markus

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Helo Markus,

If item_number in the qvd file and service_code in the SQL database are the same field but with different names, then just renaming the field and concatenating tables will work, as suggested above

Item:LOAD item_number, item_descriptionFROM $(vPathQvdRaw)\Item.qvd (qvd);CONCATENATE LOAD "service_code" as item_number, "service_description" as item_description;SQL SELECT *FROM swedb.dbo.service;


Now "Item" table will have all the information so you can STORE it in one file.

Hope this helps.

View solution in original post

3 Replies
Not applicable
Author

Use CONCATENATE Like this :

[Table1]:

LOAD * FROM TABLE1 ...

[Table2]:

CONCATENATE ('Table1') LOAD * FROM TABLE2 ....

Hope this help

Marlot

Not applicable
Author

Hi, I didn´t follow you. Maybe I didn´t describe the issue correct.

I will try again.

I have two files with different information which I would like to join into one.

Item:

LOAD

item_number,

item_description

FROM $(vPathQvdRaw)\Item.qvd (qvd);

Services:

LOAD

"service_code",

"service_description";

SQL SELECT *

FROM swedb.dbo.service;

item_number and service_code is a item number coming from different tables/sources and named differently. I would like to include the service_code into the item table.

How should I write it into the script?

Markus

Miguel_Angel_Baeyens

Helo Markus,

If item_number in the qvd file and service_code in the SQL database are the same field but with different names, then just renaming the field and concatenating tables will work, as suggested above

Item:LOAD item_number, item_descriptionFROM $(vPathQvdRaw)\Item.qvd (qvd);CONCATENATE LOAD "service_code" as item_number, "service_description" as item_description;SQL SELECT *FROM swedb.dbo.service;


Now "Item" table will have all the information so you can STORE it in one file.

Hope this helps.