首页 新闻 搜索 专区 学院

关于case的用法

0
悬赏园豆:10 [已关闭问题]
<P>我写了个这样的T_SQL语句</P> <P>select sid,subject,content,pubdate,promulgator=<BR>&nbsp;&nbsp;&nbsp;case<BR>&nbsp;&nbsp;&nbsp;&nbsp;when exists(select * from snm_scheme where did&gt;0) then (select name from&nbsp; snm_department where snm_department.did=snm_scheme.did and snm_scheme.did&gt;0) <BR>&nbsp;&nbsp;&nbsp;&nbsp;when exists(select * from snm_scheme where cid&gt;0) then (select name from snm_Center where&nbsp;&nbsp; snm_center.cid=snm_scheme.cid&nbsp;&nbsp; and snm_scheme.cid&gt;0)&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;else <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(select username from snm_user where snm_user.uid=snm_scheme.uid)<BR>&nbsp;&nbsp;&nbsp;end </P> <P>from&nbsp; snm_scheme</P> <P>我想给promulgator字段筛选后都有数据填充.现在的问题是 获得的promulgator 列结果中只有满足第一个when 条件的数据填充,这是怎么回事啊?</P> <P>有没有办法能解决</P>
yeyang的主页 yeyang | 菜鸟二级 | 园豆:418
提问于:2008-03-28 17:40
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册