Home » Other » Training & Certification » converting row to column
converting row to column [message #284509] Thu, 29 November 2007 22:58 Go to next message
boopathi.it
Messages: 9
Registered: November 2007
Location: chennai
Junior Member

Hi,
I want to select row in column order...

select no from table1
1
2
3

i need the result like this
select no from table1
1 2 3 ..
Re: converting row to column [message #284534 is a reply to message #284509] Fri, 30 November 2007 00:27 Go to previous messageGo to next message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
How is this a Data Guarg question?
Do you post in a random forum?

Search for "pivot".

Regards
Michel
Re: converting row to column [message #284549 is a reply to message #284534] Fri, 30 November 2007 01:00 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
I'm not familiar with 11g (yet) so I can't tell about the pivoting capabilities there but in older Oracle versions you are limited:

1. you know how many rows you will retrieve. Then you can make separate columns for each row using a decode/case construction.
2. you don't know how many rows you will retrieve. You can concatenate (using CONCAT_ALL, STRAGG, ...) the contents to a single string.

Search the board for more info.

MHE

[Updated on: Fri, 30 November 2007 01:01]

Report message to a moderator

Previous Topic: query for commission value
Next Topic: sql query
Goto Forum:
  


Current Time: Sat Dec 28 13:45:58 CST 2024