博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2011年4月21日

摘要: 今天遇到群里发的一个问题,觉得有点意思,发上来看一下以下代码在MYSQL中测试通过,MSSQL应该能跑通,未测试。#创建表如下create temporary table tmp (a int, b int ,c int);insert into tmp VALUES (1,10,1),(10,10,2),(10,100,2);#mysql执行select sum(case when c = '1' then A else B end) from tmp#oracle执行select sum(decode(c,'1',a,b)) from tmp#普通联合查询s 阅读全文

posted @ 2011-04-21 18:35 峰雪 阅读(271) 评论(0) 推荐(0) 编辑