查询:
select a.cName
from table1 a LEFT JOIN table2 b ON a.code=b.code
LEFT JOIN table3 ON a.code=b.code===这三个表的连接关系是怎么样的?
table1左连接table2
是table1连接table3还是table2连接table3
现在想table1同时连接table3怎么做?

解决方案 »

  1.   

    table1左连接table2
    table1左连接table3
      

  2.   

    LEFT JOIN table3 ON a.code=b.code不对的吧
      

  3.   


    select a.cName 
    from table1 a 
    LEFT JOIN table2 b ON a.code=b.code 
    LEFT JOIN table3 c ON a.code=c.code
      

  4.   

    select a.cName
    from table1 a LEFT JOIN table2 b ON a.code=b.code
    LEFT JOIN table3 c ON a.code=c.code
    table1左连接table2,又左连接table3
      

  5.   

    select   a.cName 
    from   table1   a   LEFT   JOIN   table2   b   ON   a.code=b.code 
    LEFT   JOIN   table3   c   ON   a.code=c.code 
    怎么试验得出来,这个语句和select cName from table1有什么区别?
      

  6.   

    LEFT JOIN table3 ON a.code=b.code
    --------------
    这句代码有问题。
      

  7.   


    select a.cName
    from table1 a LEFT JOIN table2 b ON a.code=b.code
    LEFT JOIN table3 c ON a.code=c.code
      

  8.   

    SELECT
    FROM ((table1 a LEFT JOIN table2 b ON  a.code = b.code)
    LEFT JOIN table3 c ON a.code = c.code)
    这个问题看似很基础!
      

  9.   

    LEFT   JOIN   table3   ON   a.code=b.code 
    上楼的兄弟,这句问题出在哪里?
      

  10.   

    http://topic.csdn.net/u/20071217/10/d1add9f1-b8d7-4d7e-b54a-7d0fdaf0210e.html看看这个吧,我前两天刚问过的,一开始没什么实践,很迷茫,但在实际中用多了会慢慢明白的:)
    学习ing~~:)
      

  11.   

    select a.cName 
    from table1 a 
    LEFT JOIN table2 b ON a.code=b.code 
    LEFT JOIN table3 c ON a.code=c.code过程是这样的:
    1, 首先table1左链接table2,得到一个中间结果,该中间结果包括table1的所有行以及table2中与table1匹配条件(a.code=b.code)的行
    2, 该中间结果左链接table3,得到最终的行集,该行集中包括上一步的中间结果的所有行以及table3中与中间结果匹配条件(a.code=c.code)的行
      

  12.   

    LEFT       JOIN       table3       ON       a.code=b.code  
    上楼的兄弟,这句问题出在哪里?
    -----------------------------
    你要连接的是 table3
    但是连接条件中写的却是 a和b,也就是table1和table3,没有table3是不行了。
    所以给table3起个别名,然后在连接条件中指定条件。
      

  13.   

    select   a.cName   
    from   table1   a   
    LEFT   JOIN   table2   b   ON   a.code=b.code   
    LEFT   JOIN   table3   c   ON   a.code=c.code 
    查询结果和select   cName   from   table1 有区别吗?
      

  14.   

    LEFT JOIN table3 ON a.code=b.code的结果和select * from table1,table3一样的 
      

  15.   

    查询结果和select       cName       from       table1   有区别吗?
    -------------------
    我想楼主是举例,实际上并不会是这种连接条件。
      

  16.   

    查询结果和select               cName               from               table1       有区别吗? 
    ------------------- 
    我想楼主是举例,实际上并不会是这种连接条件。-----------------------------
    有区别的,当code在表2不唯一的时候,返回结果是多条
      

  17.   

    select a.cName 
    from table1 a 
    LEFT JOIN table2 b ON a.code=b.code 
    LEFT JOIN table3 c ON a.code=c.code
      

  18.   

    有区别的,当code在表2不唯一的时候,返回结果是多条
    对的