ORACLE 按表字段值的不同统计数量
select p.id comperitorId,p.compcorp competitorName,
sum(case when c.kindname = 'ATM' then c.num else 0 end) atm,
sum(case when c.kindname = 'CRS' then c.num else 0 end) crs,
sum(case when c.kindname = 'VTM' then c.num else 0 end) vtm,
sum(case when c.kindname = '清分机' then c.num else 0 end) sorter,
sum(case when c.kindname = '软件' then c.num else 0 end) software,
sum(case when c.kindname = '其他' then c.num else 0 end) other,
m.iscommunication iscommunication
from compproduct c
join competitor p on c.competitor_id=p.id
join (select f.custid,t.companyid,t.iscommunication from technologycompany t join technology_flow f on f.id=t.flowid) m on c.competitor_id=m.companyid and c.cust_id=m.custid
where c.cust_id='7649'
group by p.id,c.competitor_id,p.compcorp,m.iscommunication
ORACLE 按表字段值的不同统计数量的更多相关文章
- Oracle更新表字段时内容中含有特殊字符&的解决方法
今天在做 Oracle表字段更新时出现了特殊字符&,导致无法更新. 这个问题是第二次碰到了,所以在此记录下,以备后用. 举例: update t set col1='A&B' wher ...
- ORACLE修改表字段顺序
1.若'GYZL_BZPWL_TB' 为要修改的表名,注意表名一定要大写!此句可以获取表的id.select object_id from all_objects where object_name= ...
- [Oracle]Master表字段扩张时的对应方法
Master表字段扩张时的对应方法 如果Master表的数据量很大,Master表中的列,宽度扩张了,MVIEW表如何对应处理? 此时,重建MVIEW可能会耗费很长的时间. 可以采用 alter ma ...
- oracle建表字段包含关键字注意事项
SQL建表时最好不要把表定义成关键字字段 1 若不小心把表定义成关键字了,比如option, desc等等,oracle版本查询会有问题,短期内无法修改字段名称的,暂时用字段名+双引号解决: SELE ...
- oracle修改表字段名时报错:ORA-00054:资源正忙,但指定以NOWAIT方式获取资源,或者超时失效的问题
打开sql plus select session_id from v$locked_object;查询出oracle锁定的会话ID SELECT sid, serial#, username, os ...
- SQL查询数据库表字段值不为空或Null的所有列
) set @TableName = 'Agency' -- 表名 declare @querySql nvarchar(max) set @querySql = 'select ' ) declar ...
- SQL Server 表字段值转列名 示例
前几天,同事问我怎样把字段值转换成字段列,就写了一个最简单的Demo分享一下. 代码如下: -- 创建测试表以及添加测试数据create table #temp(a money,b varchar(1 ...
- SQL Server 表字段值转换成字段名称(二)
上次写了个比较简单的只有两个字段的例子,经要求在写个 3 个字段的示例 ,贴上来与大家共勉一下 如果你们有更好的方法,提供一下, 感激不尽. 示例如下: /*--drop table temp_ ...
- 关于SQL表字段值缺失的处理办法
在计算收益率时候, 收益率 = 收益 / 成本 一.如果成本为0,NULL,此时无法计算收益率: 方法: 1.将成本为0的数据 运算 (case when cost =0 or cost is n ...
随机推荐
- windows服务安装错误 在‘安装’过程发生异常:System.ComponentModel.Win32Exception:系统正在关机
今天安装windows服务的时候先是在本地安装测试通过,但是一到服务器就一直安装失败 在‘安装’过程发生异常:System.ComponentModel.Win32Exception:系统正在关机 然 ...
- SHRINK SPACE Command : Online Segment Shrink for Tables, LOBs and IOTs
ORACLE-BASE - ALTER TABLE ... SHRINK SPACE Command : Online Segment Shrink for Tables, LOBs and IOTs ...
- C# 多线程系列(一)
线程是怎样工作的 1.多线程由一个线程调度器来进行内部管理,一个功能是CLR常常委托给操做系统. 一个线程调度器确保所有激活的线程在执行期间被合适的分配,等待或者阻塞的线程(比如,一个独占锁或者等待用 ...
- VHDL之std_logic_1164
This packages defines a standard for designers to use in describing the interconnection data types u ...
- MVC5+EasyUI+EF6+Linq通用权限系统出炉--登录(2)
1.输入验证码后 自动识别验证码并登录.
- 使用pelican创建静态博客
创建工作目录 首先使用pip安装pelican和markdown pip install pelican markdown 然后创建目录 mkdir my_blog 接着进入目录cd my_blog, ...
- 安卓桌布显示的dip和px
安卓程序设计界面显示设置图像大小,在layout.xml里面有dip和px选项,dip为 什么 暂时还不知道,或许是设计桌布的设定像素比率,px为像素值: 比如我的手机是 Lenovo K920,屏幕 ...
- POJ_1061_扩展欧几里德
青蛙的约会 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 107027 Accepted: 21321 Descript ...
- Content-Encoding值
Content-Encoding值 gzip 表明实体采用GNU zip编码 compress 表明实体采用Unix的文件压缩程序 deflate 表明实体是用zlib的格式压缩的 identity ...
- tomcat映射java目录 sever.xml
<Valve className="org.apache.catalina.authenticator.SingleSignOn" /> --> & ...