2016年11月26号随笔(关于oracle数据库)

今天写了几个小时的sql语句,一开始我并没有思路,有思路便开始写。

首先我查询了入库表中的3级单位下的各个网点的入库信息,找到这些信息后,我又去入库明细表中查询入库的详细信息

找到了我要的把捆包箱的各个id

select * from gzh_instock where outunitid
in (select organizationid from cdms_organization start with
organizationid=‘3862fa81-ac03-44de-8e82-d39dacce9c9d‘
connect by prior ORGANIZATIONID = PARENTID)

//查询各个网点下的入库单的详细信息

select * from gzh_instock_detail where billid
in (select billid from gzh_instock where outunitid
in (select organizationid from cdms_organization start with
organizationid=‘3862fa81-ac03-44de-8e82-d39dacce9c9d‘
connect by prior ORGANIZATIONID = PARENTID))

//把的残损和完整
select ISDAMAGE,count(ISDAMAGE) from gzh_bainfo where barcode
in (select barcode from gzh_instock_detail where billid
in (select billid from gzh_instock where outunitid
in (select organizationid from cdms_organization start with
organizationid=‘3862fa81-ac03-44de-8e82-d39dacce9c9d‘
connect by prior ORGANIZATIONID = PARENTID))and to_char(billdate,‘yyyy-MM‘)=‘2016-10‘ and UNIT=‘1‘) group by ISDAMAGE;
//捆的残损和完整
select ISDAMAGE,count(ISDAMAGE) from gzh_BunchInfo where bunchcode
in (select barcode from gzh_instock_detail where billid
in (select billid from gzh_instock where outunitid
in (select organizationid from cdms_organization start with
organizationid=‘3862fa81-ac03-44de-8e82-d39dacce9c9d‘
connect by prior ORGANIZATIONID = PARENTID)) and UNIT=‘2‘) group by ISDAMAGE;
//箱的残损和完整
select intactnum,damagenum from gzh_boxinfo where devcode
in (select barcode from gzh_instock_detail where billid
in (select billid from gzh_instock where outunitid
in (select organizationid from cdms_organization start with
organizationid=‘3862fa81-ac03-44de-8e82-d39dacce9c9d‘
connect by prior ORGANIZATIONID = PARENTID)) and UNIT=‘3‘);
//包的残损和完整
select intactnum,damagenum from gzh_pachetinfo where rfidno
in (select barcode from gzh_instock_detail where billid
in (select billid from gzh_instock where outunitid
in (select organizationid from cdms_organization start with
organizationid=‘3862fa81-ac03-44de-8e82-d39dacce9c9d‘
connect by prior ORGANIZATIONID = PARENTID)) and UNIT=‘4‘);
select * from gzh_boxinfo;

找到最后我要的数据后,我在我的逻辑层进行了数据的处理,得到我想要的结果。

发现自己的sql写的很散,都是一块一块的没有结合起来,直接得到我要的结果集然后我开始构思

尹哥给我的建议是从最深处的数据源开始找自己想要的代码,一步一步 的上移,得到自己想要的结果,我也是做了分析

发现这个确实提高了我对数据库操作的效率,更快的得到了自己想要的结果。

时间: 2024-08-26 16:53:09

2016年11月26号随笔(关于oracle数据库)的相关文章

11月26号host

127.0.0.1 localhost255.255.255.255 broadcasthost::1 localhostfe80::1%lo0 localhost # Google start216.239.38.125 gmail-imap.l.google.com216.239.38.125 googlemail-imap.l.google.com216.239.38.125 gmail-smtp.l.google.com216.239.38.125 googlemail-smtp.l.g

产生数组的方法 2016年12月26号

在<thinking in java>这本书中,11章练习7中,要求创建一个类,然后创建一个用你的类的对象进行过初始化的数组.这涉及到用过两个类来初始化一个数组. 首先,创建一个类 class E07_GenerateString { private static int counter; private int count=counter++; public String toString(){ return "E07_GenerateString" +count; }

[日常]总结2016年7月入职至2016年7月26号微盘所遇bug

2016年刚入职后在新浪微盘项目上所遇到的问题: 1.前端接口的程序不同版本问题,版本号在程序路径中区分,比如2.4.2/lib/sdk/api/weipan/Client.php 2.文件夹接口的mc缓存问题,用户创建文件夹的时候会从新读取数据库更新MC缓存 3.文件库和用户库分开,比如:用户表在端口4001库,文件表在端口5001库, 4.根据用户id进行分表,比如:我的uid 142262729,在user04表 5.分享文件失败问题的测试与修复 6.某一分库逻辑uid%128 取出的值大

11月26号站立会议

小组名称:飞天小女警 项目名称:礼物挑选小工具 小组成员:沈柏杉(组长).程媛媛.杨钰宁.谭力铭 代码地址:HTTPS:https://git.coding.net/shenbaishan/gift-selection.git SSH:[email protected]:shenbaishan/gift-selection.git 会议时间:2016-11-26 13:00-----13:30 会议地点:本部研究生教学楼一楼大厅 会议内容: 一.已完成项: ①数据整理--沈柏杉 ②确认礼物展示模

11月26号,Window.document对象

1.Window.document对象 docunment.getElementById(" id  ")   根据id找,最多找一个 var a= docunment.getElementById(" id  ")   将找到的元素放到变量中(赋值) docunment.getElementsByName("name")  根据name找名字,找出来的是数组 docunment.getElementsByTagName("name&q

2016年11月26日 星期六 --出埃及记 Exodus 20:17

"You shall not covet your neighbor's house. You shall not covet your neighbor's wife, or his manservant or maidservant, his ox or donkey, or anything that belongs to your neighbor." 不可贪恋人的房屋,也不可贪恋人的妻子,仆婢,牛驴,并他一切所有的.

高俊峰——运维工程师如何逆袭,11月30号QQ群575837909视频直播

时间:11月30号晚8点-9点30. 地点:QQ群直播 575837909  分享老师:高俊峰 IT系统架构专家,上海好耶集团运维总监,畅销书<循序渐进Linux>.<高性能Linux服务器构建实战>作者,51CTO专家博主. 分享内容:运维工程师如何逆袭 分享大纲: 2016年11月30号晚上8点准时开始 课前活动:到场学员晚7:58开始签到,前10名签到学员奖励100学分. 晚8:00-8:15,高俊峰老师的个人运维成长经验(15分钟) 晚8:15-9:10,运维工程师逆袭需要

4号团队-团队任务3:每日立会(11月26日至12月7日)

团队序号:04 开发的软件名称:飞机大战 团队信息: 团队只有UI设计师王菊,产品经理王擎,软件工程师.共三人 每日例会11月26日至12月7号的链接: 26日   https://www.cnblogs.com/jbbrnbs/p/10028609.html 27日   https://www.cnblogs.com/jbbrnbs/p/10028671.html 28日   https://www.cnblogs.com/jbbrnbs/p/10030865.html 原文地址:https:

软考中高项学员:2016年3月26日作业

软考中高项学员:2016年3月26日作业一.质量管理1.质量管理基本原则?2.质量管理的目标?3.质量管理的主要活动有哪些?(记)4.质量管理流程包括哪四个环节?(记)(按P'DCA理解记忆)5.ISO9000质量管理的8项原则是什么?6.全面质量管理是一种全?.全?.全?的品质管理?它由结构.技术.人员.变革推动者4个要素组成.7.全面质量管理有哪4个核心的特征?8.六西格玛意为六倍标准差,在质量上表示每百万坏品率少于多少?9.六西格玛管理法的核心是什么?而DMAIC是什么意思?包括哪四个要素