我想从该查询中选择前 1 个值(null 或值)
select top 1 column5 from table2 where table2.column1ID = 5
Run Code Online (Sandbox Code Playgroud)
如果此列的整个值为 null 则返回为空,但我需要返回值或 null
将您的选择包裹在另一个选择中。
select
(
select top 1 column5
from table2
where table2.column1ID = 5
--order by ?
) as column5
Run Code Online (Sandbox Code Playgroud)