case c_job_status when 0 then ''已暂停'' else  ''(select sonclass_name from web_son_class where parentclass_id =33 and sonclass_id = c_job_period) as c_job_period '' end请问为什么这里的select语句没效果呢?我想实现的功能是:当字段从c_job_status 的值为0时,显示c_job_period的值显示 已暂停,否则 就从数据库中查出对应的值

解决方案 »

  1.   

    c_job_period=case when c_job_status =0 then ''已暂停'' else ''(select sonclass_name from web_son_class where parentclass_id =33 and sonclass_id = c_job_period)'' end这样也没效果,帮帮忙啊
      

  2.   

    看不懂这是什么语法
    不像是sql也不像是C#~~~~lz能详细解释一下吗
      

  3.   

    把select 语句外面的引号去掉呢
      

  4.   

    (case c_job_status when 0 then ''已暂停'' else (select sonclass_name from web_son_class where parentclass_id =33 and sonclass_id = c_job_period) end )as c_job_period  end
      

  5.   

    --参照:当ID为1时返回测试 不然返回教师名称
     select case Teacher_ID when 1 then '测试' else  Teacher_Name  end
     from ME_Teacher
    --颜色标记处可为查询语句
      

  6.   

    as c_job_period 这个也要去掉