Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

Sorting a Column

639976May 20 2008 — edited May 20 2008
I have a table that i get this data out of

1
2
3
4
5
6

I Then break it up into 2 columns
1 4
2 5
3 6

What i would like to be able to do is have some way of making the 2nd column display
6
5
4

Is there some basic command that can do this to a column.

It cant be done by using order by in my case, as the inital column is ordered by and this would throw everything out of whack.

Any one know anything about this?


with t as
(SELECT (FamilyName || ' ' || GivenName) as nom, row_number() over (order by DateOfBirth ASC) as rn from member)
select t1.nom as leftside, t2.nom as rightside
from t t1, t t2
where rownum < (SELECT COUNT(memberNo) / 2 + 1 AS table_length FROM Member) and
t1.rn != t2.rn
and mod(t1.rn,(SELECT COUNT(memberNo) / 2 AS table_length FROM Member)) = mod(t2.rn, (SELECT COUNT(memberNo) / 2 AS table_length FROM Member));

this is the sql code that i currently have.

Message was edited by:
user636973
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 17 2008
Added on May 20 2008
7 comments
1,266 views