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'; ......
我EXCEL中一个单元格的数据如 "2009-01","8949-232"
将这个数据粘贴到PL/SQL中的一个表中后,数据确是成为了 2009-01,8949-232 ,把所有的""都没了,
如何弄呢?请大家试 ......
DateTime startTime=DateTime(em_1.Text)
DateTime endTime=DateTime(em_2.Text)
string sql
sql = dw_1.GetSQLSelect()+"Where (StartTime> '"+startTime+"') and (EndTime ......
有字段
日期,id
日期不重复,id 有重复
需要筛选出 每个id里面日期最早的数据。
SQL code:
select * from 表 t where not exists(select 1 from 表 where t.日期>日期 and id=t.id)
SQL ......