Three table join with joins other than INNER JOIN

后端 未结 8 1745
无人共我
无人共我 2020-12-09 00:40

I am learning SQL and am trying to learn JOINs this week.

I have gotten to the level where I can do three table joins, similar to a lot of examples I\'ve seen. I\'

8条回答
  •  误落风尘
    2020-12-09 01:28

    For the sake of completeness and standard evangelics, I'll chime in with the ansi-92 nested join syntax:

    select t1.*
        ,t2.*
        ,t3.*
    from table1 t1
        left outer join (
            table2 t2 left outer join table3 t3 on (t2.b = t3.b)
        ) on (t1.a = t2.a)
    

    Your SQL engine of choice may optimize for them.

提交回复
热议问题