SQl 数据合并,结果合并 - MS-SQL Server / 疑难问题
SQL code:
alter proc Sel_Stu_Soc
(
@Stu_Id int
)
as
select a.Stu_Id as 学号,a.Stu_Name as 姓名,a.Stu_Sex as 性别,b.Gr_Semester as 学期,
ISNULL((select b.Gr_Score where b.Gr_SubId=c.Su_Id and a.Stu_Id=b.Gr_StuId and c.Su_Id=1),0) as 语文,
ISNULL((select b.Gr_Score where b.Gr_SubId=c.Su_Id and a.Stu_Id=b.Gr_StuId and c.Su_Id=2),0) as 数学,
ISNULL((select b.Gr_Score where b.Gr_SubId=c.Su_Id and a.Stu_Id=b.Gr_StuId and c.Su_Id=3),0) as 英语
from Student as a
inner join
Grade as b
on a.Stu_Id=b.Gr_StuId
inner join
Subjects as c
on b.Gr_SubId=c.Su_Id
where Stu_Id=@Stu_Id
查询的结果execute Sel_Stu_Soc @Stu_Id=1
学号 姓名 性别 学期 语文 数学 英语
1 张三 男 2010 98 0 0
1 张三 男 2010 0 87 0
1 张三 男 2010 0 0 78
想要的结果显示
学号 姓名 性别 学期 语文 数学 英语
1 张三 男 2010 98 87 78
数据库结构:
Student:学生表
Stu_Id Stu_Name Stu_Sex
Grade: 成绩表
Gr_Semester Gr_StuId Gr_SubId Gr_Score
Subjects: 科目表
Su_Id Su_Name
SQL code:
alter proc Sel_Stu_Soc
(
@Stu_Id int
)
as
select a.Stu_Id a
相关问答:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
现在有两张表:文章主表A(articleId,articleTitle),文章评论表B(commentId,articleId,commentTitle)
现在我想实现这样的功能:列出文章列表,其中每篇文章标题下面列出此文章的前2个文章评论,请问sql语句怎么写啊 ......
如何在SQL2005中设定定时作业,比如说定时清理某些表的数据,
或者是定时的将某些表的数据导出excel!
在线等待,急急急,最好是详细步骤!
之前我做的作业有点问题!
帮UP
参考:http://hi.baidu.com/toiota ......
tab1 字段:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 字段:goodsid,goodskind(商品类型)
tab3 字段:goodskind(商品类型),kindname
结果:
得到商品类型在一段时间 ......
求个vb中的sql语句的写法,次sql语句的用法是分页程序
我写的如下:其中A是用来接收每页显示的记录的条数,B是用来接收显示的当前的页面.
sqltext="select top A * from log where id not in(select top ( ......