Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Using Resident for 2 tables

Hi Friends,

I have 2 tables as Table A and Table B with similar columns.

[Full Name],

[First Name],

[Last Name],

[User ID],

Office,

City,

State,

Country,

[Country Code],

Company,

[Region]

We can use Resident like below.

Load

[Full Name],

[First Name],

[Last Name],

[User ID],

Office,

City,

State,

Country,

[Country Code],

Company,

[Region]

Resident Table A;

But is it possible to include Table B to the above Resident call?

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this, you can use concatenate for merging two tables (similar to Union All in SQL)

Data:

SELECT

*,

'TableA' AS Source

FROM TableA;

Concatenate(Data)

SELECT

*,

'TableB' AS Source

FROM TableB;

Hope this helps you.

Regards,

Jagan.

View solution in original post

7 Replies
NareshGuntur
Partner - Specialist
Partner - Specialist

Vijay,

If both the tables have similar columns, then concatenate them and use one resident load.

Two tables can't be loaded with one Resident call.

Cheers,

Naresh

Anonymous
Not applicable
Author

Is the below correct?

Table ABC

Load....

From...Table A;

CONCATENATE

Load....

From...Table B;

NewResident:

Load

[Full Name],

[First Name],

[Last Name],

[User ID],

Office,

City,

State,

Country,

[Country Code],

Company,

[Region]

Resident Table ABC;

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this, you can use concatenate for merging two tables (similar to Union All in SQL)

Data:

SELECT

*,

'TableA' AS Source

FROM TableA;

Concatenate(Data)

SELECT

*,

'TableB' AS Source

FROM TableB;

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

An automatic concatenation will occur if the fields are the same. If you dont want to concatenate, you can force so. by using no concatenate. Keep in mind that this will cause the two tables to associate on more than one field as they hold the same name. for table B use The qualify or rename fields as desired.

so your resident call will be like the below:

Qualify *;

Unqualify [User ID]; (if you think the two tables would be associated by the user id field)

TableB:

no concatenate Load

[Full Name],

[First Name],

[Last Name],

[User ID],

Office,

City,

State,

Country,

[Country Code],

Company,

[Region]

Resident Table A;

NareshGuntur
Partner - Specialist
Partner - Specialist

Yes. It is correct.

But add one more field as Jagan suggested so that it'll be easy for you to classify the data.

TableABC:

Load....,

'TableA' as TableName

From...Table A;

CONCATENATE

Load....

'TableB' as TableName

From...Table B;


NewResident:

Load

[Full Name],

[First Name],

[Last Name],

[User ID],

Office,

City,

State,

Country,

[Country Code],

Company,

[Region]

Resident Table ABC;

Cheers,

Naresh

Not applicable
Author

we can't take resident of a table with same no. of field.

Anonymous
Not applicable
Author

Thanks friends..