首页 新闻 赞助 找找看

sql 中的 小问题

0
悬赏园豆:5 [已关闭问题]

我在sql 2005 中 用case  when  ....then 的时候  我想在then  后面写sql  语句,不知道怎么写

求救

问题补充: 那这个呢? select d.showname= case when d.showname is null then '全部' else d.showname end from (select ShowName from I_HyProdectCate where CateID = 11) d
like%'远远'%的主页 like%'远远'% | 小虾三级 | 园豆:635
提问于:2009-12-20 16:16
< >
分享
其他回答(1)
0
Jaryleely | 园豆:367 (菜鸟二级) | 2009-12-20 18:00
0

在then 后面写表达式是可以的,但是如果是写整条的sql语句,比如select 那么建议你根据条件分开成2条sql语句来执行

譬如:

  if 1=2 then

      select * from  tb

      else

         select * from tb1

直接写sql是不行的。

清海扬波 | 园豆:825 (小虾三级) | 2009-12-21 09:30
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册