读书人

sum中出现then 1 else 0的的含义解决思

发布时间: 2012-04-16 16:20:04 作者: rapoo

sum中出现then 1 else 0的的含义
在网上看到一个SQL语句是这样的。

select sum(case when fsalary>9999 and fage<35 then 1 else 0 end) from empinfo;


这里的case/end, then 1 else 0 能起到提高查询效率的作用么?为什么。

请大神们指教。

[解决办法]
不能!
可以这样写啊:
select Count(RowID) From empinfo Where fsalary>9999 and fage<35;

读书人网 >oracle

热点推荐