SQL 语句问题

(case when (case when 
(select Content from hd_advisory where dwbm=a.dwbm and parentID=a.sonID and bz='1') is null then '未回复') 
is '未回复' then '') 
第 2 行: ')' 附近有语法错误。

作者: shiyan0634   发布时间: 2011-06-16

SQL code
case when  
            not exists(select Content from hd_advisory where dwbm=a.dwbm and parentID=a.sonID and bz='1') 
            then '' end

作者: zy112429   发布时间: 2011-06-16

SQL code

case when 
(select Content from hd_advisory 
where dwbm=a.dwbm and parentID=a.sonID and bz='1') is null then '未回复' end


一般是case when then when then else end 的模式。

作者: maco_wang   发布时间: 2011-06-16

引用 2 楼 maco_wang 的回复:
SQL code


case when
(select Content from hd_advisory
where dwbm=a.dwbm and parentID=a.sonID and bz='1') is null then '未回复' end


一般是case when then when then else end 的模式。

我的意思是如果“select Content from hd_advisory 
where dwbm=a.dwbm and parentID=a.sonID and bz='1'”这句是null,那么把某一个字段(比如mc)的值置为空。请问怎么写啊?

作者: shiyan0634   发布时间: 2011-06-16

引用 3 楼 shiyan0634 的回复:
引用 2 楼 maco_wang 的回复:
SQL code


case when
(select Content from hd_advisory
where dwbm=a.dwbm and parentID=a.sonID and bz='1') is null then '未回复' end


一般是case when then when then else end 的模……
SQL code
case when 
(select Content from hd_advisory 
where dwbm=a.dwbm and parentID=a.sonID and bz='1') is null then '' end

作者: zy112429   发布时间: 2011-06-16