我需要订购这个平均值desc,但不知何故我不能。请帮忙
解决方案可能非常简单:)
答案 0 :(得分:1)
我假设您要在左列中订购具有最高值的列。我还假设您使用的是SQL Server。从图片中看起来确实如此。
The solution is probably very simple.
不知道这一点。你告诉我......
with C(A, B, C) as
(
-- Your query goes here
)
select [1],[2],[3]
from (
select Val, row_number() over(order by Val desc) as rn
from C unpivot (Val for Col in(A, B, C)) U
) T
pivot (min(val) for rn in ([1],[2],[3])) P
答案 1 :(得分:0)
SELECT X FROM
(
SELECT aa X FROM table
UNION ALL
SELECT bb X FROM table
UNION ALL
SELECT cc X FROM table
) a
ORDER BY X DESC
这样的事情会这样吗?