课程/MySQL/数据库
MySQL开发技巧(二)
-
-
慕后端2376581
2019-08-13
列转行场景:ETL数据处理
-
截图
0赞 · 0采集
-
-
慕后端2376581
2019-08-13
列转行场景:属性拆分
-
截图
0赞 · 0采集
-
-
慕粉2123427705
2019-03-07
需要进行列转行的场景
ETL数据处理
-
截图
0赞 · 0采集
-
-
慕粉2123427705
2019-03-07
需要进行列转行的场景
属性拆分
-
截图
0赞 · 0采集
-
-
12344554
2019-03-06
行转列:ETL数据处理
-
截图
0赞 · 0采集
-
-
12344554
2019-03-06
列转行:属性拆分
-
截图
0赞 · 0采集
-
-
滕玉龙
2017-06-13
- 关于学生成绩的行转列代码参考:
//表格定义及数据
create table if not exists score(
id smallint unsigned not null primary key auto_increment,
uname varchar(100) not null,
subject varchar(100) not null,
score smallint not null
)engine=innodb default charset=utf8;
insert score values
(default, 'a', 'math', 10),
(default, 'a', 'english', 20),
(default, 'a', 'chinese', 30),
(default, 'b', 'math', 50),
(default, 'b', 'english', 60),
(default, 'b', 'chinese', 70),
(default, 'c', 'math', 110),
(default, 'c', 'english', 120),
(default, 'c', 'chinese', 130);
//转换代码:
select math.uname,math.math,english.english,chinese.chinese from (select id, uname, score as math from score where subject='math') as math inner join (select id, uname, score as english from score where subject='english') as english on math.uname=english.uname inner join (select id, uname, score as chinese from score where subject='chinese') as chinese on chinese.uname=english.uname;
-
2赞 · 1采集
-
-
没死接着学
2017-02-13
- 列转行:
单列转多行:属性拆分,ETL数据处理
-
0赞 · 0采集
-
-
王大箱子
2016-07-16
- 2.1
-
截图
0赞 · 0采集
-
-
王大箱子
2016-07-16
- 2.1
-
0赞 · 0采集
-
-
纠结的小猴子
2016-05-19
- 列转行场景
-
截图
0赞 · 1采集
-
-
红烧蓝胖
2016-03-28
- 列转行场景
-
截图
0赞 · 2采集
-
-
Jde冻结
2016-02-26
- 列转行场景2
-
截图
0赞 · 0采集
-
-
Jde冻结
2016-02-26
- 列转行的场景
-
截图
0赞 · 0采集
-
-
huazhouzhang
2016-02-19
- 关于学生成绩的行转列代码参考:
//表格定义及数据
create table if not exists score(
id smallint unsigned not null primary key auto_increment,
uname varchar(100) not null,
subject varchar(100) not null,
score smallint not null
)engine=innodb default charset=utf8;
insert score values
(default, 'a', 'math', 10),
(default, 'a', 'english', 20),
(default, 'a', 'chinese', 30),
(default, 'b', 'math', 50),
(default, 'b', 'english', 60),
(default, 'b', 'chinese', 70),
(default, 'c', 'math', 110),
(default, 'c', 'english', 120),
(default, 'c', 'chinese', 130);
//转换代码:
select math.uname,math.math,english.english,chinese.chinese from (select id, uname, score as math from score where subject='math') as math inner join (select id, uname, score as english from score where subject='english') as english on math.uname=english.uname inner join (select id, uname, score as chinese from score where subject='chinese') as chinese on chinese.uname=english.uname;
-
0赞 · 0采集
-
-
IMOS
2015-12-21
- 行装列必须先知道刷选的句柄?不知道具体是多少列的情况下如何处理?
真实在开发中一般很少有直接使用数据库做报表的,所以,这个技巧真的是然并卵
-
截图
0赞 · 0采集
-
-
i_小休
2015-10-24
- 需要列转行的场景二
-
截图
0赞 · 0采集
-
-
i_小休
2015-10-24
- 需要进行列转行的场景
-
截图
0赞 · 0采集