ISNULL 兩種寫法,得到兩種結果,返回空記錄與null

yinghualeihenmei發表於2024-04-08
select isnull(salary,null) as SecondHighestSalary
from
employee
order by salary desc
offset 1 rows
fetch next 1 rows only
結果是空記錄

select isnull((
select salary
from
employee
order by salary desc
offset 1 rows
fetch next 1 rows only)
,null) as SecondHighestSalary
結果是null

相關文章