Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a question. I have 2 databases with 3 important tables. The tables in the different databases have the same fields. Example:
Database 1: Table GRBK Fields: Number,Year,Period,Amount
Database 2 Table GRBK Fields: Number,Year,Period,Amount
It is possible that both databases have the same data :
Database 1: Table GRBK 2000,2010,9,100
Database 2: Table GRBK 2000,2010,9,100
In Qlikview i need both records. Anybody knows how to combine both records ?
Hello Francis and welcome to the Forums,
Do something like the following:
LOAD *; SQL SELECT * FROM Database1; CONCATENATE LOAD *; SQL SELECT * FROM Database2;
Concatenate keyword is not needed when both tables have the same number of fields and fields are named alike. Anyway, I set it here should you have some differences between both tables.
Hope that helps
Hello Francis and welcome to the Forums,
Do something like the following:
LOAD *; SQL SELECT * FROM Database1; CONCATENATE LOAD *; SQL SELECT * FROM Database2;
Concatenate keyword is not needed when both tables have the same number of fields and fields are named alike. Anyway, I set it here should you have some differences between both tables.
Hope that helps
Hi
You could do something along these lines:
DATATABLE:
SQL SELECT Number,
Year,
Period,
Amount,
'Database1' AS Source
FROM Database1.GRBK;
CONCATENATE
SQL SELECT Number,
Year,
Period,
Amount,
'Database2' AS Source
FROM Database2.GRBK;
Jonathan
Try something like the following
CONNECTION STRING
Select
Orders_no,
Order_date,
Number,
Year,
Amount,
Period,
'DB1' as MyDatabase,
etc
From db1.scheme.orders_table;
CONCATENATE
CONNECTION STRING
Select
Orders_no,
Order_date,
Number,
Year,
Amount,
Period,
'DB2' as MyDatabase,
etc
From db2.scheme.orders_table;
Thanx to all. Jonathan i use your script. And of course it works. 🙂
Must i close this question on this forum?
I'd recommed you to do that, so any other user looking for something similar will find the question as solved.