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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
D19PAL
Creator II
Creator II

1 Fact table, trying to left join two tables into the fact from SQL

Hi Guys,

I've got 1 Fact table, trying to left join two further tables into the fact from two SQL tables, one table joins fine and I can see the fields and data, If  I try two, I can see all fields and only data from the first table, no data from the second table.

 

Any Ideas?

FactTemp:

NoConcatenate

            id   

FROM [**********.qvd] (qvd)   ;

 

LIB CONNECT TO '****************************)';

 

 

Fact table

Id

1

2

3

 

 

left Join (FactTemp)

SQL

select

            id,

    sales,

    currency

from

            Sales;

 

Fact table

Id , sales, currency

1, 10, gbp

2, 20, usd

3, 30, usd

 

   

 

LIB CONNECT TO '*********)';

 

left join (FactTemp)

SQL

select

            id,

    targets

   

from

 

            targets;

    exit Script

 

Fact table

Id , sales, currency, targets

1, 10, gbp

2, 20, usd

3, 30, usd

 

I can see the field but no data, I obviously want to see target data too.

 

Fact table

Id , sales, currency, target

1, 10, gbp, 100

2, 20, usd, 100

3, 30, usd, 100

2 Replies
jwjackso
Specialist III
Specialist III

If the 2 SQL tables are from the same database, join the 2 tables in 1 SQL statement.

 

SQL

select  s.id, s.sales, s.currency, t.target

from sales s

left join target t on t.id = s.id;

 

D19PAL
Creator II
Creator II
Author

That's one way, I didn't think of it that way.  I was using the same key for both, I created separate keys.