select a.姓名,分数=cast(isNULL(b.分数,'未参加') as varchar)
from table1 as a left join table2 as b on a.id=b.id

解决方案 »

  1.   

    select a.姓名,分数=(case when isNULL(b.分数,-1)<>-1 
           then cast(b.分数 as varchar) else '未参加' end)
    from table1 as a left join table2 as b on a.id=b.id
      

  2.   

    select a. 姓名,(case when 分数 is null then '未参加' else cast(分数 as varchar(5) end) as '分数'
    from table1 a left join  table2 b on a.id=b.id
      

  3.   

    select a. 姓名,(case when b.分数 is null then '未参加' else cast(b.分数 as varchar(5)) end) as '分数'
    from table1 a left join  table2 b on a.id=b.id