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

推荐订阅源

G
Google Developers Blog
S
SegmentFault 最新的问题
Jina AI
Jina AI
D
DataBreaches.Net
人人都是产品经理
人人都是产品经理
罗磊的独立博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
爱范儿
爱范儿
大猫的无限游戏
大猫的无限游戏
C
Check Point Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
WordPress大学
WordPress大学
博客园 - 三生石上(FineUI控件)
B
Blog
博客园 - 【当耐特】
博客园 - Franky
M
MIT News - Artificial intelligence
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
L
LangChain Blog
MyScale Blog
MyScale Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 叶小钗
Last Week in AI
Last Week in AI
Engineering at Meta
Engineering at Meta

博客园 - Blue

个已实现的例子:通过Javascript在页面中直接调用Office Communicator API - Blue cmd脚本(C# 清缓存) - Blue - 博客园 isql脚本编写创建数据库(SQL Server2000) 怎样踢mstsc占用者 copy:键盘按键和键盘对应代码表 Thread简单概念 转:ListView 中添加大数据量解决屏幕刷新“闪”的现象 Regsvr32命令全攻略 导入导出CVS文件遇到的问题 - Blue - 博客园 一个字段存很多枚举值,然后从字段取出的方法 關於泛型的資料 索引器的两种用法 在建表时使用DEFAULT是很有用的 关于web service的验证 SQL中计算月初和月末 临时表有时很有用 注意insert语句写法 case的用法 尽量减少使用游标
在GROUP语句中还可以增加很多内容
Blue · 2006-03-03 · via 博客园 - Blue

可以代替很多游标做的事情。

select  str_userid,(sum(case
when (sort<>'MT21' and sort<>'MT22' and sort<>'MS54' and sort<>'MP56')then

   (case
    when (Isnull(M1,0)/ration)>1.5 then (1.5* Isnull(str_scale,1))
    else (Isnull(M1,0)/ration)* Isnull(str_scale,1)
   end)
else ((Isnull(M1,0)/ration)* Isnull(str_scale,1))
end)
/sum(str_scale))
as m01
from Tongj_VIEW_Menology_Strong
where ration<>0 and ration is not null and year_month='2006'
group by str_userid
order by m01 desc