select b.学号,b.姓名,a.分数,a.年份,a.序号
from TB1 a,TB2 b 
where a.学号=b.学号 and a.年份='2004'
order by  a.序号\

解决方案 »

  1.   

    select biao1.学号,biao2.姓名,biao1.分数,biao1.年份,biao1.序号 from biao1,biao2
    where biao1.学号 = biao2.学号 and biao1.年份 = '2004'
      

  2.   

    select b.学号,b.姓名,a.分数,a.年份,IDENTITY(int, 1, 1) as 序号  from TB1 a,TB2 b 
    where a.学号=b.学号 and a.年份='2004'
    order by  a.序号
      

  3.   

    以上错了,不能用IDENTITY(int, 1, 1)
      

  4.   

    select b.学号,b.姓名,a.分数,a.年份,IDENTITY(int, 1, 1) as 序号 into #Tb from TB1 a,TB2 b 
    where a.学号=b.学号 and a.年份='2004'
    order by  a.序号select * from #Tb order by 序号
      

  5.   

    SELECT 表2.学号,表2.姓名,表1.分数,表1.年份,表1序号 FROM 表1,表2 WHERE 表2.学号=表1.学号
      

  6.   

    大伙看清题了!!!!!
    我想要的是:序号重新以1,2,3,4 地步长为1递增排列!!
    查询结果是:
    查询结果:
    学号  姓名  分数  年份 序号
    001   张一  100  2004  1
    002   王二  100  2004  2
    003  李三   100  2004  3
    而不是:
    查询结果:
    学号  姓名  分数  年份 序号
    001   张一  100  2004  2
    002   王二  100  2004  5
    003  李三   100  2004  7
    lcq9732(明空).答的有点对题,但还需要into到另一个表中,太麻烦,直接用select做就好了,请教!!!!谢谢!