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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
New-Qlik
Creator III
Creator III

Left Join Issue

Hi.

I have two tables and doing left join

Items:

SQL SELECT
        CustID,
    OrderNo,
    OrderType,
    ReqNo,

ReqDate  
FROM Table1
where
ReqDate>= '2016/02/26' and ReqDate<= '2016/03/26';


left  join (Items)


SQL SELECT
        ProductMasterID,
    ProductName,
    ReqNo
FROM .Table2;

Table1  return 2lacs record and Table 2 retursn 4 lacs when we run this query in database

but in Qlikview

table 1 returns 2 lacs

where as table 2 is fetching more that 10  crores

so basically doing cross join.

Please guide what wrong I am doing.

TIA

12 Replies
Anil_Babu_Samineni

Here,

How is your Data model

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
New-Qlik
Creator III
Creator III
Author

Just these two tables only

New-Qlik
Creator III
Creator III
Author

joined on basis of reqno

Clever_Anjos
Employee
Employee

If those tables are into same database, keep your script making joins using SQL not Qlik.

Believe me, much more optimized

Anil_Babu_Samineni

Items:

SQL SELECT
        CustID,
    OrderNo,
    OrderType,
    ReqNo,

ReqDate  
FROM Table1
where
ReqDate>= '2016/02/26' and ReqDate<= '2016/03/26';

// For this you will get 1 month Data only


left  join (Items)

concatenate / Join (Items)
SQL SELECT
        ProductMasterID,
    ProductName,
    ReqNo
FROM .Table2 group by ReqNo;

Final Out put is

CustID     OrderNo     OrderType     ReqNo     ReqDate     ProductMasterID     ProductName

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
New-Qlik
Creator III
Creator III
Author

These tables are coming from same database. but I didn't get your point

New-Qlik
Creator III
Creator III
Author

you are saying do concatenate instead of join?

Clever_Anjos
Employee
Employee

SELECT
        CustID,
    OrderNo,
    OrderType,
    ReqNo,

ReqDate  ,

ProductMasterID,

    ProductName


FROM Table1

LEFT join Table2 on Table1.ReqNo = Table2.Reqno
where
ReqDate>= '2016/02/26' and ReqDate<= '2016/03/26';

New-Qlik
Creator III
Creator III
Author

this is database query .

In Qv also we write like this?