大家看看,这种写法的连接,属于哪种类型的连接呀?
--------------------------------
就是下面这种写法:select *
from t1 a,t2 b
where a.id=b.id
连接有多种,我不知这是哪一种,是 inner join 还是 left join 或是别的
是下面的哪一种,或是哪种都不是
--第一种:
select *
from t1 a inner join t2 b
on (a.id=b.id)--第二种:
select *
from t1 a left join t2 b
on (a.id=b.id)

解决方案 »

  1.   

    select *
    from t1 a,t2 b
    where a.id=b.id
    -------
    内连接 只取两边匹配的行
      

  2.   


    select *
    from t1 a,t2 b
    where a.id=b.id应该属于第一种吧!
    默认的应该是按INNER JOIN来执行的,除非指定了OUTER JOIN。
      

  3.   

    In the SQL-92 standard, inner joins can be specified in either the FROM or WHERE clause. This is the only type of join that SQL-92 supports in the WHERE clause. Inner joins specified in the WHERE clause are known as old-style inner joins.把连接条件放在where里被认为是老式的写法,SQL92标准只支持该种。Oracle里则会看到 a.id = b.id(+)的情况
      

  4.   

    我个人认为 把连接条件放在where里要清晰一些
      

  5.   

    可是新的标准是将连接条件写在 on 后面呀。
    我觉得写在 on 后面,可读性更好些。
      

  6.   


    --測試
    inner   join
      

  7.   

    我还是习惯用这种写法,而不习惯用inner join这种写法.
    楼下的,问下这两种写法效率怎么样
      

  8.   

    可是新的标准是将连接条件写在on后面呀。我觉得写在on后面,可读性更好些。 
    -------
    呵呵 我就是觉得如果N个表相连 inner join之间并没有顺序关系,然后看起来有点辛苦。你比如select a.col1,b.col3,c.col4,d.col2..,f.colx from a 
    inner join b on a = col1=b.col1
    inner join c on b.col2=c.col2 -- row #3
    inner join d on d.col6=c.col6 -- row #4
    ....
    inner join f on f.colx=c.colx连接行可以随意换 有时候把关系反正弄混了 其实这应该是我眼睛不好的原因拉..