是这样吗:--drop table a,bcreate table a(id1 int,id2 int)insert into a
select 1  ,2  union all
select 2  ,3  union all
select 3  ,4create table b(id int,v varchar(10))insert into b
select 1  ,'a' union all
select 2  ,'b' union all
select 3  ,'c' union all
select 4  ,'d'
goselect b1.v,b2.v
from a
left join b b1
       on b1.id = a.id1
left join b b2
       on b2.id = a.id2
/*
v v
a b
b c
c d
*/       

解决方案 »

  1.   

    select b1.v,b2.v
    from a
    inner join b b1
           on b1.id = a.id1
    inner join b b2
           on b2.id = a.id2
      

  2.   


    select   (select v from b where id= id1 ) , (select v from b where id= id2 )  from a
      

  3.   

    你用表a和表b关联两次,然后用不同的列字段关联,显示相应的ID对应的字符就ok了
      

  4.   


    create table a(a1 int,a2 int)insert a select 1,2
    union all
    select 2,3
    union all
    select 3,4
    create table b(b1 int,b2 varchar(30))insert into b select 1,'a'
    union all
    select 2,'b'
    union all
    select 3,'c'
    union all
    select 4,'d'
    select (select b2 from b where b1=a1),(select b2 from b where b1=a2 ) from a