Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

OR Condition in Qlikview...How can we write in a Qlikview ?

DECLARE @var VARCHAR(30) ='2860587'

SELECT *

FROM   shipment AS a

       LEFT OUTER JOIN customer AS b

                    ON a.consignee_customer_id = b.customer_id

       LEFT OUTER JOIN customer AS c

                    ON a.shipper_customer_id = c.customer_id

       LEFT OUTER JOIN customer d

                    ON a.bill_to_customer_id = d.customer_id

WHERE  b.[customer_number] = @var

        OR c.customer_number = @var

  or dcustomer_number = @var

How can we write in a Qlikview ?

1 Reply
andrewpettit
Partner - Creator
Partner - Creator

You could try something like this, maybe not the most efficient but it should work.  If your concerned with possibly duplicating rows in the shipment table then I would consider building a junction table between shipment and customer.

// LOAD USING CONSIGNEE JOIN

MyTable:

NOCONCATENATE

LOAD * RESIDENT shipment;

LEFT JOIN (MyTable) LOAD

     consignee_customer_id AS customer_id,

     ... other fields ...

RESIDENT customer WHERE customer_number = '$(var)';

// LOAD USING SHIPPER JOIN

MyTable_tmp:

NOCONCATENATE

LOAD * RESIDENT shipment;

LEFT JOIN (MyTable) LOAD

     shipper_customer_idas AS customer_id,

     ... other fields ...

RESIDENT customer WHERE customer_number = '$(var)';

CONCATENATE(MyTable)

LOAD * RESIDENT MyTable_tmp;

DROP TABLE MyTable_tmp;

// LOAD USING BILL TO JOIN

MyTable_tmp:

NOCONCATENATE

LOAD * RESIDENT shipment;

LEFT JOIN (MyTable) LOAD

     bill_to_customer_id AS customer_id,

     ... other fields ...

RESIDENT customer  WHERE customer_number = '$(var)';

CONCATENATE(MyTable)

LOAD * RESIDENT MyTable_tmp;

DROP TABLE MyTable_tmp;