「SQL入門」複数テーブルをleft joinで結合するサンプル

SQL構文

SELECT
  T1_TBL.ID
  , T2_TBL.NO
  , T3_TBL.NUM 
FROM
  T1_TBL 
  LEFT JOIN T2_TBL 
    ON T2_TBL.ID = T1_TBL.ID 
    AND T2_TBL.NO = T1_TBL.NO 
  LEFT JOIN T3_TBL 
    ON T3_TBL.NUM = T1.NUM

 

Software

Posted by arkgame