首页 > 解决方案 > 在查询如何在 Oracle 中的另一列上按顺序获取一列时

问题描述

Oracle SQL 我想按另一列顺序获取一列

例如

X Y
ab 4
cd 2
ef 3
gh 1

我想要第 2 列的 A 列

o/p
X
gh
cd
ef
ab

另一件事:我基本上从另一个来源查看 view1

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

所以我在查询这个视图

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

那么它是否保证它会按照 y 的顺序排列?或者我怎样才能按 y 的顺序制作它。

标签: sqloracle

解决方案


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.


推荐阅读