query to ignore duplicate/null records

前端 未结 3 475
夕颜
夕颜 2021-01-26 06:36

Below are the 3 tables which we need to join to get the data

 TableA         TableB               TableC
    AId          BId     Name      CId       DeclareDate         


        
3条回答
  •  温柔的废话
    2021-01-26 07:12

    use left join into table C

      select a.*,b.*, c.DeclareDate, c.Value from TableA a
       inner join TableB b on  a.AI =b.BId
      left join 
      (select * from TableC where DeclareDate='December') c
       on b.BId = c.CId
    

    OUTPUT

提交回复
热议问题