Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
grahum
Contributor
Contributor

load 2 tables

Hi 

i have 2 tables to load via mysql , both tables have the same fields , i need after the load of the sql to have 2 tables in the qlikview so i can use each table , when i am running this i am getting all in "table1" and not table 1 and table 2 , any idea why ? 

 

table1:
SELECT *
FROM prod.queries
where year(query_time) > '2018';

 

table2:
SELECT *
FROM pmx.queries
where year(query_time) > '2018';

 

2 Replies
rubenmarin

Hi, that can be because both tables has the same field names, and is doing an autoconcatenation, joining both tablas in one.

NoConcatenate or set "Qualify *;" at start can avoid, also you can add a dedicated field to identify the origin of each data:
table1:
SELECT *,
'prod' as Origin
FROM prod.queries
where year(query_time) > '2018';

table2:
SELECT *,
'pmx' as Origin
FROM pmx.queries
where year(query_time) > '2018';
Gysbert_Wassenaar

Because the two tables have exactly the same fields. If that's the case then Qlikview automatically concatenates the tables.

If you don't want that then you can use the NoConcatenate keyword in front of the Select keyword.

Personally, I think that sounds like bad idea in this case. I'd add a Source field to register where the data came from, but I'd keep all the records in one table.

table1:
SELECT *, 'prod' as Source
FROM prod.queries
where year(query_time) > '2018';

CONCATENATE (table1)

SELECT *, 'pmx' as Source
FROM pmx.queries
where year(query_time) > '2018';

The field Source can then be used if you need to select data from a specific source.


talk is cheap, supply exceeds demand