TABLEA
id value1
1  a
2  b
3  cTABLEB
id value2
2  d
3  e
4  f我要结果,另外这种联接叫什么联接?
id value1 value2
1  a
2  b       d
3  c       e       
4          f

解决方案 »

  1.   

    select * from tablea ,table b where tablea.id*=*tableb.id?
      

  2.   

    create table TABLEA(id int,value1 varchar(50))
    insert into tablea select 1,'a'
    insert into tablea select 2,'b'
    insert into tablea select 3,'c'create table TABLEB(id int,value2 varchar(50))
    insert into TABLEB select 2,'d'
    insert into TABLEB select 3,'e'
    insert into TABLEB select 4,'f'
    select coalesce(a.id,b.id) as id,isnull(a.value1,'') as value1,isnull(b.value2,'') as value2
    from tablea a full join tableb b on a.id=b.id
      

  3.   

    id value1 value2
    1 a
    2 b d
    3 c e
    4 f
      

  4.   

    FULL JOIN 有能用*号连的
    ?
      

  5.   

    select isnull(m.id , n.id) id , isnull(m.value1 , '') value1 , isnull(n.value2 , '') value2
    from tablea m full join tableb n on m.id = n.id 
      

  6.   

    create table TABLEA(id int,value1 varchar(50))
    insert into tablea select 1,'a'
    insert into tablea select 2,'b'
    insert into tablea select 3,'c'create table TABLEB(id int,value2 varchar(50))
    insert into TABLEB select 2,'d'
    insert into TABLEB select 3,'e'
    insert into TABLEB select 4,'f'
    select isnull(m.id , n.id) id , isnull(m.value1 , '') value1 , isnull(n.value2 , '') value2
    from tablea m full join tableb n on m.id = n.id drop table tablea , tableb/*
    id          value1                                             value2                                             
    ----------- -------------------------------------------------- -------------------------------------------------- 
    1           a                                                  
    2           b                                                  d
    3           c                                                  e
    4                                                              f(所影响的行数为 4 行)
    */
      

  7.   

    谢谢各位,
    我的意思是这个语句可不可以像左连接不用LEFT JOIN用'*=',右连接用'=*'
    这个如果用表达示也用表达式要怎么写呢?
      

  8.   

    我要用这种格式的:
    select * from #t1,#t2 where #t1.id*=#t2.id(比方左连接)