Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Join Three Tables in DB Level

Hi All,

               I am new to QlikView, I want to join 3 tables in  DB,  before loading data into QlikView. by using Sql Query.

Can any one help me with some example.

Regards,

Sruthi

5 Replies
hariprasadqv
Creator III
Creator III

This might help you.

SELECT a.au_lname, a.au_fname, t.title
FROM authors a INNER JOIN titleauthor ta
  ON a.au_id = ta.au_id JOIN titles t
  ON ta.title_id = t.title_id
WHERE t.type = 'trad_cook'
ORDER BY t.title ASC

shambhub
Creator
Creator

Hi Sruthi,

Below I have given a script which can be executed in QV Script. Here I have taken 3 tables

1) Customer order lines

2) Item master file

3) Customer master

I have performed joining among these 3 tables and even I have given script for preceding load in QV also.

Please let me know for any help.

Order_Lines:

Load [Customer order number],

      [Item number],

      [Item name],

      [Customer number],

      [Customer number],

      [Entry date];

SELECT M.[Customer order number],

       M.[Item number],

       L.Name [Item name],

       M.[Customer number],

       C.[Customer name],

       M.[Entry date]

FROM DBO.[Customer order lines] M --Table 1

LEFT OUTER JOIN DBO.[Item master file] L on --Table 2

L.[Item number] = M.[Item number]

LEFT OUTER JOIN dbo.[Customer master] C on --Table 3

C.[Customer number] = M.[Customer Number];

Best Regards

Shambhu B

prma7799
Master III
Master III

Please Check

  SELECT a.ord_num,b.cust_name,a.cust_code,    c.agent_code,b.cust_city 

  FROM agents c,customer b,orders a 

  WHERE b.cust_city=c.working_area 

  AND a.cust_code=b.cust_code 

  AND a.agent_code=c.agent_code;

Thanks

PM

avinashelite

Hi Sruthi,

Their are many types of join left,right, inner etc you have not mentioned the exact requirement.

Try like this:

Select * from

table1 t1 left join table2 t2 left join table3 t3

on t3.common_key_between_table2_table3=t2.common_key_between_table2_table3

on t2.common_key_between_table2_table1=t1.common_key_between_table2_table1

robert_mika
Master III
Master III

Look here for some help