Oracle decode()函数应用
在项目第一次遇到decode()函数,简单写一下用法。
select count(*),sum(decode(fz.station_class_f, '租用机房', '', '')),
sum(decode(fz.station_class_f, '自建彩钢板机房', '', '')),
sum(decode(fz.station_class_f, '自建砖混机房', '', '')),
sum(decode(fz.station_class_f, '一体化机柜', '', '')),
sum(decode(fz.station_class_f, 'RRU拉远', '', '')),
sum(decode(fz.station_class_f, '其他机房', '', '')),
sum(decode(fz.station_class_f, '无机房', '', ''))
from wg_jzmb jz, wg_jzfz fz
where jz.station_code = fz.station_code
and jz.STATION_STAT in ('启用', '暂停支付')
decode(条件1,值1,值2,值3) 如上格式所示
decode(fz.station_class_f, '自建彩钢板机房', '1', '0')
fz.station_class_f字段等于 "自建彩钢板机房" 字符串时,取到值"1",若不等于取到值"0"
再通过sum()函数完成对该数据的累加计算。
Oracle decode()函数应用的更多相关文章
- Oracle DECODE函数的语法介绍
Oracle DECODE函数功能很强,下面就为您详细介绍Oracle DECODE函数的用法,希望可以让您对Oracle DECODE函数有更多的了解. Oracle DECODE函数 Oracle ...
- Oracle DECODE函数的用法详解
Oracle DECODE函数使用方法: 1.比较大小select decode(sign(变量1-变量2),-1,变量1,变量2) from dual; --取较小值sign()函数根据某个值是0. ...
- Mysql-通过case..when实现oracle decode()函数进行多值多结果判断
oracle的decode函数使用:http://www.cnblogs.com/hwaggLee/p/5335967.html case ..when 函数使用:http://www.cnblogs ...
- oracle decode函数用法
DECODE函数是ORACLE PL/SQL是功能强大的函数之中的一个,眼下还仅仅有ORACLE公司的SQL提供了此函数,其它数据库厂商的SQL实现还没有此功能.DECODE有什么用途 呢? 先构造一 ...
- oracle decode()函数的参数原来可以为sql语句!
1.情景展示 判断某个字段的值,如果以APP开头,需查询APP表里对应的数据:如果是以JG开头,就查询机构对应的表. 2.原因分析 如果使用CASE WHEN THEN或者IF ELSIF 太麻烦 ...
- oracle decode函数 和 case when
1.oracle decode分支函数 select decode(to_char(B.LQSJ, 'hh24:mi:ss'), '00:00:00', to_char(B.LQSJ, 'yyyy-m ...
- Oracle decode函数 除数为零
decode (expression, search_1, result_1)如果 expression结果=search_1结果,则返回result_1,类似 if elsedecode (expr ...
- [Oracle] decode 函数及其用法
http://blog.csdn.net/oscar999/article/details/18399177 前言 DECODE()函数,它将输入数值与函数中的参数列表相比较,根据输入值返回一个对应值 ...
- oracle decode函数和 sign函数
流程控制函数 DECODE decode()函数简介: 主要作用: 将查询结果翻译成其他值(即以其他形式表现出来,以下举例说明): 使用方法: Select decode(columnname,值1, ...
随机推荐
- qsort C++ VS2013 leetcode
class Solution { private: static int compare(const void * a, const void * b) { return (*(int*)a - *( ...
- CSS中的class与id区别及用法
转自http://www.divcss5.com/rumen/r3.shtml及http://www.jb51.net/css/35927.html 我们平常在用DIV CSS制作Xhtml网页页面时 ...
- 反编译软件jad
http://blog.csdn.net/small____fish/article/details/7687261 这是原网址,挺全的. 官网上下载jad,再把jad.exe 复制到javahome ...
- k8s dashboard 部署发布
https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml # Copyright 2015 ...
- [Nginx] - 负载均衡配置
nginx.conf文件内容: user www www; worker_processes 2; error_log /usr/local/nginx/logs/serror.log crit; p ...
- winform中messageBox七个参数的使用(转载)
private void button1_Click(object sender, EventArgs e) { MessageBox.Show(" 1 个参数 ”); } private ...
- 跨平台开发之阿里Weex框架环境搭建(一)
转载自:http://www.cnblogs.com/fozero/p/5995122.html 一.介绍 Weex是阿里今年6月份推出的跨平台解决方案,6月底正式开源.官网 https://alib ...
- php5.3到php7.0.x新特性介绍
<?php /*php5.3*/ echo '<hr>'; const MYTT = 'aaa'; #print_r(get_defined_constants()); /* 5.4 ...
- PICT安装与使用
一.PICT简介 PICT工具是在微软公司推出的一款成对组合的命令行生成工具,下载地址http://download.microsoft.com/download/f/5/5/f55484df-849 ...
- c++虚函数调用及使用
#include <iostream> using namespace std; class A { public: ; }; class B: public A { public: ; ...