请教 自定义列 如何替换Null ?
select
*,(select type from tableB where tableA.id = tableB.id)
from tableA
1 NULL
0 NULL
0 周末
0 NULL
请教如何将Null批量成别的字符串呢?
select
*,(select case when type is Null then '空字符串' else then type end from tableB where tableA.id = tableB.id)
from tableA
这样也不行,因为内查询没有查询到数据,
将case 放到最外边,总是报错.
------解决方案--------------------ISNULL(col,'aa')
------解决方案--------------------SQL code
select
*,(select isnull(type,'你想要的字符串') from tableB where tableA.id = tableB.id)
from tableA
------解决方案--------------------
SQL code
select
*,(select isnull(type,'别的字符') from tableB where tableA.id = tableB.id)
from tableA