Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Table on its side
--------------B21FE9AA38CA3E9E6C12E925 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit
Has anyone had any experience turning a table on its side?
For example:
I have a table A
with columns id and name
and I want to have all the records represented as columns
So say I have 5 records in the table here is what the query would show:
Id Name1 Name2 Name3 Name4 Name5
1 Bhope LWelk TDanza SLee SCue
Now I can do this with a self join 5 times but if I add a record I lose the info in the 6th record.
Is there any way to dynamically handle this?
Thanks, Dave Turner
-- Dave Turner, Senior Database Administrator, Linuxcare, Inc. 913.383.3052 tel, 913.579.3803 cel, 913.652.0687 fax, 877.443.9553 pager dturner@linuxcare.com, http://www.linuxcare.com/ Linuxcare. Support for the revolution. -- --------------B21FE9AA38CA3E9E6C12E925 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bitReceived on Mon Jun 19 2000 - 12:00:59 CDT
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Has anyone had any experience turning a table on its side?
<p>For example:
<p>I have a table A
<br>with columns id and name
<p>and I want to have all the records represented as columns
<p>So say I have 5 records in the table here is what the query would
show:
<p>Id Name1 Name2 Name3 Name4 Name5
<br>1 Bhope LWelk TDanza
SLee SCue
<br>
<p>Now I can do this with a self join 5 times but if I add a record I lose
the info in the 6th record.
<p>Is there any way to dynamically handle this?
<br>
<p>
Thanks, Dave Turner
<br>
<pre>--
Dave Turner, Senior Database Administrator, Linuxcare, Inc. 913.383.3052 tel, 913.579.3803 cel, 913.652.0687 fax, 877.443.9553 pager dturner@linuxcare.com, <A HREF="http://www.linuxcare.com/">http://www.linuxcare.com/</A> Linuxcare. Support for the revolution. --</pre>