oracle 11g行转列 列转行

行转列:

SELECT *   
FROM   src_table   
UNPIVOT (param_value FOR param_name IN (product_color AS 'product_color', product_type AS 'product_type', is_intelligent AS 'is_intelligent'));

 

列转换:

 select *  from (

select flow,xx from tab

)   a pivot (max(value) for enname in ( 'flow' flow ,'xx')) b order by id ";

你可能感兴趣的:(oracle 11g行转列 列转行)