select t1.*,t3.性别,t2.成绩 from t1 inner join t2 on t1.编号=t2.编号 
inner join t3 on t1.编号=t3.编号

解决方案 »

  1.   

    create table t1(编号 int,姓名 varchar(20))
    insert t1 select 1,'jack'
    union all select 2,'tom'
    union all select 3,'jone'
    union all select 4,'peter'
    union all select 5,'white'
    create table t2(编号 int,成绩 int)
    insert t2 select 1,88
    union all select 2,78
    union all select 3,80
    create table t3(编号 int,性别 varchar(5))
    insert t3 select 2,'男'
    union all select 4,'女'
    union all select 5,'男'select t1.*,t3.性别,t2.成绩 from t1 left join t2 on t1.编号=t2.编号 
    left join t3 on t1.编号=t3.编号
      

  2.   

    select t1.*,isnull(t3.性别,'') as 性别,isnull(t2.成绩,'') 成绩 from t1 left join t2 on t1.编号=t2.编号 
    left join t3 on t1.编号=t3.编号
      

  3.   

    create table t1(编号 int,姓名 varchar(10))
    insert into t1 select 1,'jack'   
    union all select 2,'tom'     
    union all select 3,'jone'    
    union all select 4,'peter'
    union all select 5,'white'create table t2(编号 int,成绩 int)
    insert into t2 select 1,88      
    union all select 2,78     
    union all select 3,80create table t3(编号 int,性别 varchar(10))
    insert into t3 select 2,'男'
    union all select 4,'女'
    union all select 5,'男'
    go
    select a.编号,
             姓名,
             性别,
             成绩 
    from 
     t1 a,t2 b,t3 c
    where
     a.编号*=b.编号 and a.编号*=c.编号
    drop table t1,t2,t3