A表:  B表
a     001
b     002
c     003
d     004
e得到:
a001
b002
c003
d004
e

解决方案 »

  1.   

    select a.c1+a.c2
    from tA ,tB
    where tA.m =tB.nA
    m  c1
    1  a
    2  b
    3  cb
    n  c2
    1  001
    2  002
    3  003
    ------------------------------------
    体验速度,体验CSDN论坛助手:http://community.csdn.net/Expert/TopicView.asp?id=4700683
      

  2.   

    create table a(col varchar(10))
    insert a select 'a'
    union all select 'b'
    union all select 'c'
    union all select 'd'
    union all select 'e'
    create table b(col varchar(10))
    insert b select '001'
    union all select '002'
    union all select '003'
    union all select '004'
    select id=identity(int),* into #a from a
    select id=identity(int),* into #b from b
    select #a.col+isnull(#b.col,'') from #a left join #b on #a.id=#b.id
      

  3.   

    create table A(aa nchar(10))
    insert into a
    select 'a'
    union all
    select 'b'
    union all
    select 'c'
    union all
    select 'd'
    union all
    select 'e'
    create table b(bb nchar(10))
    insert into b
    select '001'
    union all
    select '001'
    union all
    select '001'
    union all
    select '001'
    select * ,identity(int,1,1) as id into #a from a
    select * ,identity(int,1,1) as id into #b from b
    select  rtrim(#a.aa)+isnull(ltrim(#b.bb),'') from #a left join #b
    on #a.id=#b.id