SQL字段,横向展开
请问各位,如何将SQl中,某字段中的值横向展开呢,
CASE WHEN
具体问题具体分析,看你要怎么展开
姓名 科目 成绩
张三 英语 90
李四 英语 85
王五 英语 80
张三 数学 95
李四 数学 92
王五 数学 98
张三 语文 80
李四 语文 85
王五 语文 82
————————————————
结果
————————————————
姓名 英语 数学 语文
张三 90 95 80
李四 85 92 85
王五 80 98 92
相关问答:
with adod_dict do
begin
close;
commandtext:='select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd=:tnd group by bgqxcode'; ......
两种错误:
1.如果我这样申明:ResultSet rs;错误提示如下:
An error occurred at line: 51 in the jsp file: /index.jsp
The local variable rs may not have been initialized
48: ......
表中按datadate,tradeid为主键,也就是说tradeid会重复出现在不同天中,同一天的tradeid是不同的。现在我希望取一段时间范围内不重复的tradeid,且只要每个tradeid的最后一次出现的那条。sql语句该怎么写
: ......
DateTime startTime=DateTime(em_1.Text)
DateTime endTime=DateTime(em_2.Text)
string sql
sql = dw_1.GetSQLSelect()+"Where (StartTime> '"+startTime+"') and (EndTime ......
大家帮忙看看这2个sql语句哪个查询的速度更快点。谢谢帮忙。比较着急。在做性能测试。
select * from
表A LEFT OUTER JOIN 表B ON (表A.id || ' ' =表B.id) ,表C , 表D, 表E
Where其他条件
select * ......