Bcause of Null Value data is not refleting

后端 未结 2 1666
情话喂你
情话喂你 2021-01-24 10:25

I have two tables view_shipment_order_release and order_release_remark. When there is no record in order_release_remark for a given order_release_gid, there is no data shown.

2条回答
  •  逝去的感伤
    2021-01-24 10:55

    Use left join instead. left join will not be strict and will still display even if there is no data on related party.

    select distinct 
      vsor.shipment_gid,
      vsor.order_release_gid,
      orem1.remark_text as Related_Party,
      orem2.remark_text as ULTIMATE_CONSIGNEE_TYPE,
      orem3.remark_text as CONSIGNEE_TYPE
    from view_shipment_order_release vsor
    LEFT JOIN  order_release_remark orem1
    ON  orem1.REMARK_QUAL_GID ='GECORP.CONSIGNEE TYPE'
     and orem1.order_release_gid=vsor.order_release_gid
      LEFT JOIN order_release_remark orem2
      ON orem2.REMARK_QUAL_GID ='GECORP.RELATED PARTY'  
      and orem2.order_release_gid=vsor.order_release_gid
      LEFT JOIN order_release_remark orem3 
     ON orem3.REMARK_QUAL_GID ='GECORP.ULTIMATE CONSIGNEE TYPE'
    and orem3.order_release_gid=vsor.order_release_gid
    where vsor.shipment_gid='GECORP.101027274';
    

提交回复
热议问题