Kettle行列转换

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文本文件输出

3.执行后查看输出文本文件

 

posted @ 2016-09-14 11:48  OLIVER_QIN  阅读(12388)  评论(0编辑  收藏  举报