sql语句
来源:互联网 发布:什么是软件实施工程师 编辑:程序博客网 时间:2024/05/23 13:54
select t.item_id,
max(a.item_name) as itemname,
max(getunitname(a.item_code)) as unitname,
max(decode(t.company_code,'0101',decode(t.budget_time,2015,t.item_value))) as value1,
max(decode(t.company_code,'0102',decode(t.budget_time,2015,t.item_value))) as value2,
max(decode(t.company_code,'0103',decode(t.budget_time,2015,t.item_value))) as value3,
max(decode(t.company_code,'0104',decode(t.budget_time,2015,t.item_value))) as value4,
max(decode(t.company_code,'0105',decode(t.budget_time,2015,t.item_value))) as value5,
max(decode(t.company_code,'0106',decode(t.budget_time,2015,t.item_value))) as value6,
sum(decode(t.budget_time,2015,t.item_value)) as ietmvalue,
sum(decode(t.budget_time,2014,t.item_value)) as lastietmvalue
from table t,tables a
where a.item_id = t.item_id
and t.budget_time in ('2015','2014')
and t.topic_id = '45'
and exists (select 1 from CBM_J_BUDGET_GATHERCOM tt,CBM_C_ITEM aa
where aa.item_id = tt.item_id and tt.topic_id = '45' and tt.budget_time ='2014')
group by t.item_id order by t.item_id
包括decode判断,as name,和exists 字符三种功能
- SQL语句
- sql语句
- SQL语句
- SQL语句
- SQL语句
- SQL语句
- SQL语句
- SQL语句
- SQL 语句
- sql语句
- sql语句
- Sql语句
- SQL语句
- SQL语句
- sql语句
- SQL 语句
- sql语句
- sql语句
- iOS开发 - 面试题
- hdu 1394 线段树
- Maven应用笔记
- 改装版 hiwifi 1S 路由器 带wifidog客户端 带wifidog本地认证服务器源代码
- Eclipse自动生成类或方法注释的快捷键
- sql语句
- 第8周项目2-加班费,要不要?
- android libs 中jar包关联源码的方法
- hdu 1394 归并排序
- ajax乱码 easyui IE 火狐 传值乱码问题
- 寻找开放的录像服务器SDK接口
- PHP草根论之设计模式-备忘录模式
- 用户体验设计师常用的21款工具和应用
- selenium2.0—iframe对元素定位的影响