Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i flip query result? 1

Status
Not open for further replies.

navrsalemile

Programmer
Feb 6, 2005
62
CA
Hi,

I wonder if anybody can help me with this. I have a query which returns single column:

cntr
=====
55555
44444
...

The numbers can be different depending on the WHERE condition, but the number of rows can be limited to 10.

No I would like this result to be shown as:

cntrs
=================
55555, 44444, ...

i.e. as one row and values separated by commas.
I assume I cannot use DECODE since the values from the original query can be different i.e. not known in advance, but not sure...
 
Code:
select max(decode(rownum,1,cntr))||','||
max(decode(rownum,2,cntr))||','||
....
max(decode(rownum,10,cntr))
from ...

Regards, Dima
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top