Skip to content
Advertisement

I have issue in join while fetching data

I have three table and structure as below :

  1. abc
     id name    education
     1  test1   a
     2  test2   b
     3  test3   c
  1. pqr
    id  name    abcid
    1   takr    1
    2   test21  1
    3   testlll 2
  1. xyz
    id  name    abcid
    1   takr    2
    2   test21  2
    3   testlll 3

I want all the data based on abc table id

below is the query

SELECT d.ID,l.VALUE_ID as RI_ID,l.UF_CRM_1486370412 as RI_AMT, f.VALUE_ID as Finance_Id , f.UF_CRM_1595053941 as FI_AMT
FROM  b_uts_crm_lead as l
JOIN b_crm_deal as d
ON d.ID = l.UF_CRM_1600342528 
JOIN b_uts_crm_financeaddition as f
ON d.ID = f.UF_CRM_1600350766

Advertisement

Answer

I am guessing you want left join:

select . . .    -- the columns you want
from abc left join
     xyz
     on xyz.abcid = abc.id left join
     pqr
     on pqr.abcid = abc.id;
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement