SELECT
ID,
*,
rnum
FROM
get_XXX_list (?, ‘{}’) Dev,
(
SELECT
MAX (A .login_time) access_time,
A .device_id,
ROW_NUMBER () OVER (
ORDER BY
MAX (A .login_time) DESC
) AS rnum
FROM
session_log A,
usr_obj B
WHERE
A .usr = B.account
AND B. ID = % s
GROUP BY
device_id
) D
WHERE
D.device_id = Dev. ID
ORDER BY
D.rnum
postgresql根据指定序列进行自定义排序
最新推荐文章于 2024-10-11 11:37:45 发布