例如有这样的例子:
船的类型:
船的建造年份:null
船的长宽:20 m X 4 m
船的总吨位:null
船的自重 :null
船的旗帜:null
船的呼叫编号:
船的IMO:0
船的历史名称:null
图片的数量:1
图片的编号:167939
最后弄成这个样子 :
    船的类型   船的建造年份 船的长宽··                                
                 null      20 m X 4 m··

解决方案 »

  1.   

    可以使用decode 函数
    给你个例子参考
    http://zhidao.baidu.com/question/170878452
      

  2.   

    用 SYS_CONNECT_BY_PATH 函数也可实行行列转换。
      

  3.   

    select t.c,
         max(    decode(ship_type,'船的类型',bulid_year)    ) as ship_type , 
         max(    decode(ship_type,'船的建造年份',bulid_year ) ) as bulid_year , 
         max(    decode(ship_type,'船的长宽',bulid_year )    ) as ship_width,
         max(    decode(ship_type,'船的总吨位',bulid_year )    ) as ton,
         max(    decode(ship_type,'船的自重 ',bulid_year )    ) as weight,
         max(    decode(ship_type,'船的旗帜 ',bulid_year )    ) as flag,
         max(    decode(ship_type,'船的呼叫编号 ',bulid_year )    ) as ship_call,
         max(    decode(ship_type,'船的IMO ',bulid_year )    ) as IMO,
         max(    decode(ship_type,'船的历史名称 ',bulid_year )    ) as history_name,
         max(    decode(ship_type,'图片的数量 ',bulid_year )    ) as ship_amount,
         max(    decode(ship_type,'图片的编号 ',bulid_year )    ) as photo_code
     from abc t
     group by t.c
    这样就可以搞定了,谢谢大家啦!
      

  4.   

    那kettle工具中的行转列,怎么操作啊