select e.ename,e.sal,
coalesce(
(select min(sal) from emp d where d.sal>e.sal),
(select min(sal) from emp)
) as forware,
coalesce(
(select max(sal) from emp d where d.sal<e.sal),
(select max(sal) from emp)
) as rewind
from emp e
order by 2;
时间: 2024-10-27 12:55:27