Answers for "left join in sql with 3 tables"

SQL
15

left join in sql with 3 tables

-- LEFT OUTER JOIN is equivalent to LEFT JOIN
-- b.VALUE1 is null when ID not in table2 (idem for c.VALUE1 in table3)
SELECT a.ID, a.NAME, b.VALUE1, c.VALUE1 FROM table1 a 
  LEFT OUTER JOIN table2 b ON a.ID = b.ID
  LEFT OUTER JOIN table3 c ON a.ID = c.ID
WHERE a.ID >= 1000;

-- ⇓ Test it ⇓ (Fiddle source link)
Posted by: Guest on July-08-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language