Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
AnirajDupe
Contributor
Contributor

How to convert Sql join with multiple condition with different table in Qlik

Hello Experts,

In the below join clause please look into the last part where employee table joined with a11.CA_INVOICES and again a14.CA_CLIENT_ACCOUNT_HISTORY.How to Implement the last part in Qlik?

I have joined CA_EMPLOYEES with CA_CLIENT_ACCOUNT_HISTORY table then again join CA_INVOICES

but that did not give me the require result. If I associate CA_EMPLOYEES to both table then a loop is generating. Please help me to solve this.

Join Clause---

IFCAS.CA_TIME_ENTRIES a11
join IFCAS.CA_INVOICES a12
on (a11.TIME_INVO_DLOC_NO = a12.INVO_DLOC_NO and
a11.TIME_INVO_NO = a12.INVO_NO)
join CA_PROJECTS a13
on (a11.TIME_CACC_NO = a13.PROJ_CACC_NO and
a11.TIME_CLIE_ID = a13.PROJ_CACC_CLIE_ID and
a11.TIME_PROJ_NO = a13.PROJ_NO)
join IFCAS.CA_CLIENT_ACCOUNT_HISTORY a14
on (a13.PROJ_CACC_CLIE_ID = a14.CACC_CLIE_ID and
a13.PROJ_CACC_NO = a14.CACC_NO)
join CA_OFFICES a15
on (a14.CACC_OWN_OFFI_ID = a15.OFFI_ID)
join CA_DEPARTMENTS a16
on (a13.PROJ_OWN_DEPT_ID = a16.DEPT_ID)
join CA_REFERENCE_CODES a17
on (a16.DEPT_GLOB_CODE = a17.REFC_CODE)
join CA_CHARGE_BASIS_TYPE a18
on (a13.PROJ_CBAT_ID = a18.CBAT_ID)
join IFCAS.CA_EMPLOYEES a19
on (a12.INVO_BCON_EMPL_ID = a19.EMPL_ID and
a14.CACC_BCON_EMPL_ID = a19.EMPL_ID)

Labels (4)
3 Replies
Kushal_Chawda

@AnirajDupe  There are 9 tables involved here in joining condition starting with a11 to a19. So you need to join all these 9 tables together to get desire output

AnirajDupe
Contributor
Contributor
Author

That I know but how to join the last part that is employee table join?

First join employee with account history then again join to invoice

Digvijay_Singh

Check if 'where exists' can be used,

e.g. where exists(CACC_BCON_EMPL_ID,EMPL_ID)