惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
SegmentFault 最新的问题
Y
Y Combinator Blog
Recorded Future
Recorded Future
博客园 - Franky
I
InfoQ
T
The Blog of Author Tim Ferriss
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
T
Tailwind CSS Blog
Cyberwarzone
Cyberwarzone
The Register - Security
The Register - Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
雷峰网
雷峰网
P
Palo Alto Networks Blog
G
GRAHAM CLULEY
Cloudbric
Cloudbric
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
MongoDB | Blog
MongoDB | Blog
F
Full Disclosure
Google DeepMind News
Google DeepMind News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Check Point Blog
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
T
Threat Research - Cisco Blogs
U
Unit 42
N
Netflix TechBlog - Medium
The Cloudflare Blog
Spread Privacy
Spread Privacy
Microsoft Azure Blog
Microsoft Azure Blog
美团技术团队
T
Troy Hunt's Blog
Engineering at Meta
Engineering at Meta
H
Heimdal Security Blog
TaoSecurity Blog
TaoSecurity Blog
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
B
Blog
S
Securelist
H
Hacker News: Front Page
Google Online Security Blog
Google Online Security Blog
G
Google Developers Blog

博客园 - @缺水的鱼@

悼念google! excel的sql 也有单元格字符类型不匹配的 spa模式 测试 outlook2003重复收邮件的解决办法 Windows2003安装MSN9的完整解决方案 批量修改表的所有者对象 域环境下,发现无法访问共享服务器 选定的用户拥有对象,所以无法除去该用户 sql2000 因为选定的用户拥有对象,所以无法除去该用户 isa2004+windows2003网页打开需刷新多次才能打开 erp实施调研问卷 男子汉大丈夫 不谋全局者,不足以谋一隅,不谋大势者,不足以谋一时 唉,运气啥时候能来呢!!! 终于毕业了! windows脚本中心网址 sql case碰上的问题,很高兴找到了答案 sql2005中删除用户出现“数据库主体在该数据库中拥有 架构,无法删除”解决办法
sql case碰上的问题,很高兴找到了答案
@缺水的鱼@ · 2008-04-02 · via 博客园 - @缺水的鱼@

sql case when语句的奇怪问题

有这么条语句
  select top 1000 *,

              '库存描述' =
     CASE
         WHEN stk_On_Hand <=  0 THEN '缺货'
         WHEN stk_On_Hand>= 1 and stk_On_Hand < 3 THEN '少量'
         WHEN stk_On_Hand>= 4  THEN '大量'
    END
from wareh_stk

却会出现空值,

在这个blog找到了答案,引用下

http://www.blogjava.net/hsith/archive/2006/04/23/42566.html

4.         Case when语句中只能出现 =>=<= 以及is null运算符,不能出现 <><>!=、以及is not null运算符。否则在Oracledecode函数无法表达。
   当必须使用 <, >, != is not null
时,建议采用如下变通方法:
          1)使用 !=时:例如
   case  when  A!=B  then  e,
        可改为  case  A=b  then  e1  else  e   (间接实现
A!=B)
          2)使用 < 时:例如
   case  when  A<B  then  e,
        可改为  case  A<=b  then  case A=B  then  e1  else  e  (间接实现
A<B)
        或    case  A>=b  then  e1  else  e    (间接实现
A<B)
          3)使用 > 时:例如
   case  when  A>B  then  e, 
        可改为  case  A>=b  then  case A=B  then  e1  else  e   (间接实现
A>B)
        或    case  A<=b  then  e1  else  e    (间接实现
A>B)
          4)使用is  not  null  时:例如
  case  when  A  is  not  null  then  e,
        可改为:  case  A   is  null  then  e1   else   e  (间接实现
A  is  not  null)
特别说明:当执行大数据量的操作时,sql  Server  case when 的执行效率极低,甚至可能会死机,因此希望大家尽量不要使用case when