Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

add fields directly in the script

Hello,

I have 4 identical databases (tables, fields) with different names (society A, society B...).

And it can concatenate fields from the database but differ in an additional field added to the script:

example:
database A:
date
sale
seller

database B:
date
sale
seller


I wish a result:
date
sale
seller
database

thank you for your help.

twist

Labels (1)
1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hi,

That's very usual. You will have to both create the new field and use the CONCATENATE keyword in the second load and after is the fields are not the same to force concatenation:

Table:

LOAD *,

     'Database1' AS Database;

SQL SELECT *

FROM Database1;

CONCATENATE (Table) LOAD *,

     'Database2' AS Database;

SQL SELECT *

FROM Database2;

CONCATENATE (Table) LOAD *,

     'Database3' AS Database;

SQL SELECT *

FROM Database3;

Hope that helps.

Miguel

View solution in original post

3 Replies
Miguel_Angel_Baeyens

Hi,

That's very usual. You will have to both create the new field and use the CONCATENATE keyword in the second load and after is the fields are not the same to force concatenation:

Table:

LOAD *,

     'Database1' AS Database;

SQL SELECT *

FROM Database1;

CONCATENATE (Table) LOAD *,

     'Database2' AS Database;

SQL SELECT *

FROM Database2;

CONCATENATE (Table) LOAD *,

     'Database3' AS Database;

SQL SELECT *

FROM Database3;

Hope that helps.

Miguel

Not applicable
Author

Thanks you for your help

twist

johnw
Champion III
Champion III

If the fields are and will always be exactly the same, it might be simpler to use a loop:

FOR EACH DB IN 'Society A','Society B','Society C','Society D'
    Societies:
    LOAD *, $(DB) as Database;
    SQL SELECT Date, Seller FROM $(DB);
NEXT