2013-10-10 71 views
1

我想从这个查询前1没有返回null

select top 1 column5 from table2 where table2.column1ID = 5 

选择顶部1值null或值,如果此列全值为null返回的是空的,但我需要返回值或null

回答

3

将您的选择包裹在另一个选择中。

select 
    (
    select top 1 column5 
    from table2 
    where table2.column1ID = 5 
    --order by ? 
) as column5