PostgreSQL 在窗口函数中进行组内排序
PostgreSQL 窗口函数 About 222 wordsSQL
窗口函数内的order by
,可以使用case when
来排序。
select *,
row_number() over(partition by age order by
case
when height > 190 then 1000+height
when height > 180 then 2000
else 3000
end)
from "user";
Views: 22 · Posted: 2024-12-19
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...