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;

你可能感兴趣的:(oracle,多行转多列)