oracle中多行数据转换为多列

CREATE OR REPLACE VIEW VIEW_LC_REALDATA_DY AS
SELECT
terminalno,terminalname,
terminaltime,servertime,direction,
MAX(DECODE(dataitemno,'1',receivedata))  AS ady,
MAX(DECODE(dataitemno,'2',receivedata))  AS bdy,
MAX(DECODE(dataitemno,'3',receivedata))  AS cdy
FROM
MS_Realdata   GROUP BY terminaltime,servertime,direction,terminalno,terminalname;

猜你喜欢

转载自a--bian.iteye.com/blog/2116725
今日推荐