Riddhi Patel
Riddhi Patel

Reputation: 49

while querying how to get one column with order by on another column in Oracle

Oracle SQL I want to get one column in order by another column

e.g.

X Y
ab 4
cd 2
ef 3
gh 1

I want column A with order of 2nd

o/p
X
gh
cd
ef
ab

Another thing: I had basically view view1 from another source

select distinct X, Y, Z
from table 
order by Y

So I am querying on this view

select X from view1 where z='(:value)'

So does it gurantee it will be in order of y? Or how can I make it in order of y.

Upvotes: 0

Views: 299

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269583

Are you simply looking for order by?

select x
from t
order by y;

If so, this is very basic SQL and you should study up on the basics if you are attempting to use the language.

Upvotes: 1

Related Questions