有表结构如下:
PERNO     IODATE          IOTIME
1      2007-01-01           08:01
1      2007-01-01           09:20
1      2007-01-01           10:16
1      2007-01-01           15:13
2      2007-01-01           08:01
2      2007-01-01           09:20
2      2007-01-01           10:16
2      2007-01-01           15:13使用查询语句怎么使其排列成
PERNO    IODATE       IOTIME1  IOTIME2  IOTIME3 IOTIME4
1       2007-07-01     08:01   09:20   10:16  15:13
2       2007-07-01     08:01   09:20   10:16  15:13后面时间列数不固定。

解决方案 »

  1.   

    http://atgc.itpub.net/post/22412/251110
      

  2.   

    参照下面写法:select  vendor,           
               sum(decode(stage,'芯片检验',qty,0)) as  xpjy,
              sum(decode(stage,'磨片',qty,0)) as  mp,
              sum(decode(stage,'划片',qty,0)) as  hp,   
              sum(decode(stage,'包装',qty,0)) as  bz
    from  test  group by  vendor