Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: how do I combine 24 rows(3 columns) into one row (
Hi,
select name,date
sum(decode(rownum,1,hour,0) hour1 sum(decode(rownum,2,hour,0) hour2 sum(decode(rownum,3,hour,0) hour3 sum(decode(rownum,4,hour,0) hour4 sum(decode(rownum,5,hour,0) hour5 sum(decode(rownum,6,hour,0) hour6 sum(decode(rownum,7,hour,0) hour7 sum(decode(rownum,8,hour,0) hour8 sum(decode(rownum,9,hour,0) hour9 sum(decode(rownum,10,hour,0) hour10 sum(decode(rownum,11,hour,0) hour11 sum(decode(rownum,12,hour,0) hour12 sum(decode(rownum,13,hour,0) hour13 sum(decode(rownum,14,hour,0) hour14 sum(decode(rownum,15,hour,0) hour15 sum(decode(rownum,16,hour,0) hour16 sum(decode(rownum,17,hour,0) hour17 sum(decode(rownum,18,hour,0) hour18 sum(decode(rownum,19,hour,0) hour19 sum(decode(rownum,20,hour,0) hour20 sum(decode(rownum,21,hour,0) hour21 sum(decode(rownum,22,hour,0) hour22 sum(decode(rownum,23,hour,0) hour23 sum(decode(rownum,24,hour,0) hour24
rownum really is not a good thing to use. The table really needs a column to sequence the rows.
Mike Stout Received on Fri Feb 19 1999 - 18:29:18 CST