Kettle行列转换

参考 :http://blog.itpub.net/29254281/viewspace-1271742/ 

Kettle是一种开源的ETL工具

 

行转列并不陌生 

http://blog.itpub.net/29254281/viewspace-775660/

 

 

Kettle在控件中拥有行列转换功能,但是行列转换貌似是弄反了。

一.行转列

1.数据库脚本

复制代码
create TABLE StudentInfo
(
    studentno int,
    subject varchar(10),
    grade int 
);
insert into StudentInfo values(201105545,'语文',80); insert into StudentInfo values(201105545,'数学',82); insert into StudentInfo values(201105545,'英语',84); insert into StudentInfo values(201105543,'语文',70); insert into StudentInfo values(201105543,'数学',74); insert into StudentInfo values(201105543,'英语',76); insert into StudentInfo values(201105548,'语文',90); insert into StudentInfo values(201105548,'数学',93); insert into StudentInfo values(201105548,'英语',94); commit;
复制代码

2.总体行转列示意图

2.1表输入配置

2.2列转行配置

 

2.3字段选择配置

2.4文本文件输出配置

输出到文件后查看内容

二.列转行

1.数据库脚本

复制代码
CREATE TABLE StudentInfo_TMP(studentno INT,Chinese INT,Math INT,English int);

INSERT INTO StudentInfo_TMP VALUES(201105543,70,74,76);

INSERT INTO StudentInfo_TMP VALUES(201105545,80,82,84);

INSERT INTO StudentInfo_TMP VALUES(201105548,90,93,94);
复制代码

2.整体示意图

2.1表输入

2.2行转列

 

2.3字段选择

2.4文本文件输出

猜你喜欢

转载自iteyeblogs.iteye.com/blog/2387932
今日推荐