|
-
Hi !
I think you can do it if you know the maximum number of rows. I tried an example giving 1 to a maximum of 5 cols.
(There may be a more elegant way, but it works.)
Commit;
6502
----- cut here ----------------
select decode(anzahl.zahl
,1, sg1.id
,2, sg1.id
,3, sg1.id
,4, sg1.id
,5, sg1.id
,NULL
) sg1
, decode(anzahl.zahl
,2, sg2.id
,3, sg2.id
,4, sg2.id
,5, sg2.id
,NULL
) sg2
, decode(anzahl.zahl
,3, sg3.id
,4, sg3.id
,5, sg3.id
,999999
) sg3
, decode(anzahl.zahl
,4, sg4.id
,5, sg4.id
,NULL
) sg4
, decode(anzahl.zahl
,5, sg5.id
,NULL
) sg5
, anzahl.zahl
from (select * from servicegroup where is_top='Y') sg1
, (select * from servicegroup where is_top='Y') sg2
, (select * from servicegroup where is_top='Y') sg3
, (select * from servicegroup where is_top='Y') sg4
, (select * from servicegroup where is_top='Y') sg5
, (select count(*) zahl from servicegroup where is_top = 'Y') anzahl
where (sg1.id < sg2.id or anzahl.zahl < 2)
and (sg2.id < sg3.id or anzahl.zahl < 3)
and (sg3.id < sg4.id or anzahl.zahl < 4)
and (sg4.id < sg5.id or anzahl.zahl < 5)
----- cut here ----------------
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|