你的表结构和记录格式好象不是对应的。
表A (2列)
  A.Id
  A.Name
假设A表中含有一条记录(4列)
 李名   A班   数学老师  语文老师 

解决方案 »

  1.   

    base table is Cselect C.* , B.* , A.* 
    from A,B,C
    where A.班级 = C.班级
    and B.班级 = C.班级
      

  2.   

    其实是这样的。字段可以不用理会,我给出的只是相关的字段
    他们中有
    A表.A班=B表.A班
    A表.A班=c表.A班意味着
    表A 
      A.Id
      A.Name
      A.field3
      A.field4
    表B
      B.Id1
      B.Name1
      B.field3表C
      C.Id2
      C.Name2 
      C.field3假设A表中含有一条记录
     李名   A班   数学老师  语文老师 假设B表中含有两条记录
     小明   A班   学生
     小李   A班   学生假设C表中含有三条记录
     数学作业   小明  A班
     语文作业   小明  A班
     XX作业     小明  A班
    我想直接显示如上,,,
     我不想先select * from TableA
      然后 select * from tableB where tableB.name=tableA.name
     再 select * from tableC where tableC.name=tableA.name
    这样来显示记录。能否直接用一条语句做到。例如是使用
    inner join 
     or union  
    我怎么想都不能实现?????
      

  3.   

    select Id,  Name,  field3,  field4 from 表A
    union all
    select Id1,  Name1,  field3, '' from 表B
    union all
    select Id2,  Name2,  field3, '' from 表C
      

  4.   

    declare @a table (aId varchar(50),aname varchar(50),afield3 varchar(50),afield4 varchar(50))
    insert into @a values('李名','A班','数学老师','语文老师')declare @b table (bid varchar(50),bname varchar(50),bfield3 varchar(50))
    insert into @b values('小明','A班','学生')
    insert into @b values('小李','A班','学生')
    insert into @b values('小王','D班','学生')declare @c table(cid varchar(50),cname varchar(50),cfield3 varchar(50))
    insert into @c values('数学作业','小明','A班')
    insert into @c values('语文作业','小明','A班')
    insert into @c values('XX作业'  ,'小明','A班')
    insert into @c values('XX作业'  ,'小罗','D班')select * from @a a where a.aname='A班'
    union all
    select b.*,null from @a a left join @b b on b.bname=a.aname
    union all
    select c.*,null from @a a left join @c c on c.cfield3=a.aname