1)
select d.code,d.names, n.sname from
(select t.code_syndrome code,t.name_syndrome names from csmw_management_syndrome t) d,
(SELECT '01' CODE,'发病数' sNAME FROM dual UNION ALL SELECT '02' CODE,'占缺课总人数百分比'names FROM dual) n
order by code,n.code
ps: d和n分别表示一个表,两个表做笛卡尔积。
2)select distinct(s.date_report) A,s.ILL_STUDENT_NUM B,s.zonecode C from csmw_statistics_s_syndrome s
结果为:
A B C
1 2011-06-28 16 31011500
2 2011-06-28 70 31011500
3 2011-06-29 30 31011500
4 2011-06-29 60 31011500
如果为select distinct(s.date_report) A,s.zonecode C from csmw_statistics_s_syndrome s
结果为:
A C
1 2011-06-28 31011500
2 2011-06-29 31011500
如果 select distinct(s.date_report A,s.ILL_STUDENT_NUM B,s.zonecode C) from csmw_statistics_s_syndrome s 会报错,distinct只能用于一个字段或所有字段。
3)一个表为:
date_report code ill_count
1 2011-06-28 01 16
2 2011-06-28 02 16
3 2011-06-28 01 70
4 2011-06-28 02 70
5 2011-06-29 01 30
6 2011-06-29 02 30
7 2011-06-29 01 60
8 2011-06-29 02 60
ill_count是每一个日期的生病总人数,那么不同的code的ill_count也是相同的。因此想求每天的ill_count总数,
那么不能写:select date_report,sum(ill_count) from A group by date_report ,这样的ill_count就会算重了,
因此应该写:select date_report,sum(ill_count) from ( select distinct(date_report),ill_count from A) group by date_report
4)orcale中没有split函数,需要自己写函数实现,一般写的函数都会返回一个table类型的值回来,所以取的话也要
这样写:
select * from table( split('a,b',',') )
另外replace函数返回的是一个字符串,所以如果想用 a in (replace('01||02','||',',')的话实际上in里面是一个值,而不是想像中的 a in (01,02),所以想实现这样的功能的话应该再加上split函数,结合起来,如下:
a in (select * from table(split(REPLACE('01||02','||',','),',')))
5)按一个列分组,然后取每个分组的记录数,如select age,count(*) from users group by age
结果为 a 6 ,b 3 ,c 9 这样,但是如果在根据插入时间来筛选的话,就可能会出现a 5,b 2。c就没有了,现在想要出现
a 5,b 2,c 0,就要写成:
select '0' ,age from sari_j_caseinfo where inserttime>2011-01-01 union all
select to_char(count(*)),age from users where inserttime>2011-01-01 group by age
6) 有表 lws_q_bl_result ,字段为
groupresult_id, sample_id, detect_orgcode, monitorsort, hi_detect, hi_date, hi_status, srh_detect, srh_date, srh_status, note, detectmethod, del, state, orgcode, greate, greatedate, changer, changedate, id, send_org, receive_org, auditor, detector, hi_type
需求:lws_q_bl_result 表中的 sample_id 应是唯一的,所以每个相同sample_id只保留一条,由于基本上重复的数据均是除了id,greatedate都相同,所以只要把除了id,greatedate两列以外其余列都相同的数据保留第一条,其余的数据的del 字段设为1就可以了。
第一步:取得除了id,greatedate两列以外其余列都相同的数据
select id from lws_q_bl_result t where (nvl(groupresult_id, '#'), nvl(sample_id, '#'), nvl(detect_orgcode, '#'), nvl(monitorsort, '#'), nvl(hi_detect, '#'), nvl(hi_date, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(hi_status, '#'), nvl(srh_detect, '#'), nvl(srh_date, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(srh_status, '#'), nvl(note, '#'), nvl(detectmethod, '#'), nvl(del, '#'), nvl(state, '#'), nvl(orgcode, '#'), nvl(greate, '#'), nvl(changer, '#'), nvl(changedate, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(send_org, '#'), nvl(receive_org, '#'), nvl(auditor, '#'), nvl(detector, '#'), nvl(hi_type, '#')) in (select nvl(groupresult_id, '#'), nvl(sample_id, '#'), -- 当值是空时用#号代替 nvl(detect_orgcode, '#'), nvl(monitorsort, '#'), nvl(hi_detect, '#'), nvl(hi_date, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(hi_status, '#'), nvl(srh_detect, '#'), nvl(srh_date, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(srh_status, '#'), nvl(note, '#'), nvl(detectmethod, '#'), nvl(del, '#'), nvl(state, '#'), nvl(orgcode, '#'), nvl(greate, '#'), nvl(changer, '#'), nvl(changedate, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(send_org, '#'), nvl(receive_org, '#'), nvl(auditor, '#'), nvl(detector, '#'), nvl(hi_type, '#') from lws_q_bl_result where del = 0 group by nvl(groupresult_id, '#'), nvl(sample_id, '#'), nvl(detect_orgcode, '#'), nvl(monitorsort, '#'), nvl(hi_detect, '#'), nvl(hi_date, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(hi_status, '#'), nvl(srh_detect, '#'), nvl(srh_date, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(srh_status, '#'), nvl(note, '#'), nvl(detectmethod, '#'), nvl(del, '#'), nvl(state, '#'), nvl(orgcode, '#'), nvl(greate, '#'), nvl(changer, '#'), nvl(changedate, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(send_org, '#'), nvl(receive_org, '#'), nvl(auditor, '#'), nvl(detector, '#'), nvl(hi_type, '#') having count(*) > 1)
第二步,找出每组重复数据中的除第一行以外的数据。
select id from (select id,rownum as row_num from lws_q_bl_result r where r.sample_id = 'B10226072') where row_num>1
上面这行语句可以找出sample_id='B10226072' 时除第一行以外的数据,但是它无法做到先分组后再取得每组的除第一条以外的数据。故只能先把每组的第一条先插入到一个表里,再做处理。
insert into lws_q_bl_result_new( groupresult_id, sample_id, detect_orgcode, monitorsort, hi_detect, hi_date, hi_status, srh_detect, srh_date, srh_status, note, detectmethod, del, state, orgcode, greate, changer, changedate, send_org, receive_org, auditor, detector, hi_type ) select nvl(groupresult_id, '#'), nvl(sample_id, '#'), nvl(detect_orgcode, '#'), nvl(monitorsort, '#'), nvl(hi_detect, '#'), nvl(hi_date, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(hi_status, '#'), nvl(srh_detect, '#'), nvl(srh_date, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(srh_status, '#'), nvl(note, '#'), nvl(detectmethod, '#'), nvl(del, '#'), nvl(state, '#'), nvl(orgcode, '#'), nvl(greate, '#'), nvl(changer, '#'), nvl(changedate, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(send_org, '#'), nvl(receive_org, '#'), nvl(auditor, '#'), nvl(detector, '#'), nvl(hi_type, '#') from lws_q_bl_result where del = 0 group by nvl(groupresult_id, '#'), nvl(sample_id, '#'), nvl(detect_orgcode, '#'), nvl(monitorsort, '#'), nvl(hi_detect, '#'), nvl(hi_date, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(hi_status, '#'), nvl(srh_detect, '#'), nvl(srh_date, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(srh_status, '#'), nvl(note, '#'), nvl(detectmethod, '#'), nvl(del, '#'), nvl(state, '#'), nvl(orgcode, '#'), nvl(greate, '#'), nvl(changer, '#'), nvl(changedate, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(send_org, '#'), nvl(receive_org, '#'), nvl(auditor, '#'), nvl(detector, '#'), nvl(hi_type, '#') having count(*) > 1
3)给 lws_q_bl_result_new 表的 id,greatedate 两列赋值,id取每组第一条记录。
update lws_q_bl_result_new t set (t.id,t.greatedate) = (select s.id,s.greatedate from lws_q_bl_result s where nvl(s.groupresult_id, '#') = t.groupresult_id and nvl(s.sample_id, '#') = t.sample_id and nvl(s.detect_orgcode, '#') =t.detect_orgcode and nvl(s.monitorsort, '#')=t.monitorsort and nvl(s.hi_detect, '#')=t.hi_detect and nvl(s.hi_date, to_date('1950-01-01', 'yyyy-mm-dd'))=t.hi_date and nvl(s.hi_status, '#')=t.hi_status and nvl(s.srh_detect, '#')=t.srh_detect and nvl(s.srh_date, to_date('1950-01-01', 'yyyy-mm-dd'))=t.srh_date and nvl(s.srh_status, '#')=t.srh_status and nvl(s.note, '#')=t.note and nvl(s.detectmethod, '#')=t.detectmethod and nvl(s.del, '#')=t.del and nvl(s.state, '#')=t.state and nvl(s.orgcode, '#')=t.orgcode and nvl(s.greate, '#')=t.greate and nvl(s.changer, '#')=t.changer and nvl(s.changedate, to_date('1950-01-01', 'yyyy-mm-dd'))=t.changedate and nvl(s.send_org, '#')=t.send_org and nvl(s.receive_org, '#')=t.receive_org and nvl(s.auditor, '#')=t.auditor and nvl(s.detector, '#')=t.detector and nvl(s.hi_type, '#')=t.hi_type and rownum=1 )
4)把符合条件的数据DEL值设为1
update lws_q_bl_result set del = 1 where id in (select id from lws_q_bl_result t where (nvl(groupresult_id, '#'), nvl(sample_id, '#'), nvl(detect_orgcode, '#'), nvl(monitorsort, '#'), nvl(hi_detect, '#'), nvl(hi_date, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(hi_status, '#'), nvl(srh_detect, '#'), nvl(srh_date, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(srh_status, '#'), nvl(note, '#'), nvl(detectmethod, '#'), nvl(del, '#'), nvl(state, '#'), nvl(orgcode, '#'), nvl(greate, '#'), nvl(changer, '#'), nvl(changedate, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(send_org, '#'), nvl(receive_org, '#'), nvl(auditor, '#'), nvl(detector, '#'), nvl(hi_type, '#')) in (select nvl(groupresult_id, '#'), nvl(sample_id, '#'), nvl(detect_orgcode, '#'), nvl(monitorsort, '#'), nvl(hi_detect, '#'), nvl(hi_date, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(hi_status, '#'), nvl(srh_detect, '#'), nvl(srh_date, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(srh_status, '#'), nvl(note, '#'), nvl(detectmethod, '#'), nvl(del, '#'), nvl(state, '#'), nvl(orgcode, '#'), nvl(greate, '#'), nvl(changer, '#'), nvl(changedate, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(send_org, '#'), nvl(receive_org, '#'), nvl(auditor, '#'), nvl(detector, '#'), nvl(hi_type, '#') from lws_q_bl_result where del = 0 group by nvl(groupresult_id, '#'), nvl(sample_id, '#'), nvl(detect_orgcode, '#'), nvl(monitorsort, '#'), nvl(hi_detect, '#'), nvl(hi_date, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(hi_status, '#'), nvl(srh_detect, '#'), nvl(srh_date, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(srh_status, '#'), nvl(note, '#'), nvl(detectmethod, '#'), nvl(del, '#'), nvl(state, '#'), nvl(orgcode, '#'), nvl(greate, '#'), nvl(changer, '#'), nvl(changedate, to_date('1950-01-01', 'yyyy-mm-dd')), nvl(send_org, '#'), nvl(receive_org, '#'), nvl(auditor, '#'), nvl(detector, '#'), nvl(hi_type, '#') having count(*) > 1) and del = 0 and id not in (select id from lws_q_bl_result_new))
7)
有表csmw_collection_hospital,如下
ID_SYMPTOM_HOSPITAL | SYMPTOM |
ECB513EF-5DCC-441C-A6B4-65AC96FBCF8C | 8 |
C83AB542-6926-42E9-B4A6-9F3C8693331F | 8 |
73D14E69-0D77-42C7-80BF-4B4D56F780BC | 8 |
E5515D94-9F81-48CF-B0AE-5B442C93CEF4 | 8 |
356AEE63-8D5F-4095-A3BA-15B31ECEAB4F | 8 |
440AED70-46FF-4BD0-BCFB-329FBBBC4955 | 07||08 |
1D7B67D8-AF2C-4844-9036-9A07B6E41169 | 8 |
AD4B54B4-1297-4B95-BF0B-8D1E8671E46B | 8 |
00471FFD-F044-4B69-8F2E-CCF0B5B4230F | 01||02||08 |
现在要把该表插到另一个表A中, 字段为ID,ID_PARENT(为原表的ID_SYMPTOM_HOSPITAL),SYMPTOM ,其中要把SYMPTOM这样有||线的值拆成几条记录(根据||线的数量)
编写函数如下:
create or replace function TEST1 return varchar2 is Result varchar2(20); a varchar2(20); begin for z in (select * from csmw_collection_hospital where rownum<100) //取前100条记录 loop if(instr(z.symptom,'||',1,1)>0) -- instr函数方法为(字段值,查找的字符串,开始位置(从1开始),取第几次出现的) then -- =0 表示没查到 for y in (select column_value as dd from table(select split(z.symptom,'||') symptom from dual)) loop -- 不能是select * from table(select split(z.symptom,'||') symptom from dual)) ,因为下面的 -- insert语句要用到"y.",如果没有别名的话就无法写,因此需要给table表的colmun_value取个别名 insert into A(id,id_parent,symptom) values(sys_guid(),z.id_symptom_hospital,y.dd); end loop; end if; end loop; commit; return(Result); end TEST1;
8)假如有列的值为9901||9902||9903 ,如果想查询条件为既是9901又是9903的,那么SQL为如下:
select * from test where rowname||'||' like '%9901||%9903||%' (查询时要在列名前加上||)
如果是mysql的话,则不能使用 || 这个符号,mysql的拼接用的是concat(rowname,"||")
PS: 这里9901||9902中间的是分隔符,可以随便换成任何特殊符号如逗号分号
相关推荐
基于arm64版本的docker-compose文件
台区终端电科院送检文档
埃夫特机器人Ethernet IP 通讯配置步骤
rv320e机器人重型关节行星摆线减速传动装置研发
气缸驱动爬杆机器人的设计().zip
56tgyhujikolp[
内容概要:本文档提供了基于OpenCV的数字身份验证系统的Python代码示例,涵盖人脸检测、训练和识别三个主要功能模块。首先,通过调用OpenCV的CascadeClassifier加载预训练模型,实现人脸检测并采集多张人脸图像用于后续训练。接着,利用LBPH(局部二值模式直方图)算法对面部特征进行训练,生成训练数据集。最后,在实际应用中,系统能够实时捕获视频流,对比已有的人脸数据库完成身份验证。此外,还介绍了必要的环境配置如依赖库安装、文件路径设置以及摄像头兼容性的处理。 适合人群:对计算机视觉感兴趣的研发人员,尤其是希望深入了解OpenCV库及其在人脸识别领域的应用者。 使用场景及目标:适用于构建安全认证系统的企业或机构,旨在提高出入管理的安全性和效率。具体应用场景包括但不限于门禁控制系统、考勤打卡机等。 其他说明:文中提供的代码片段仅为基本框架,可根据实际需求调整参数优化性能。同时提醒开发者注意隐私保护法规,合法合规地收集和使用个人生物识别信息。
内容概要:本文档详细介绍了Java并发编程的核心知识点,涵盖基础知识、并发理论、线程池、并发容器、并发队列及并发工具类等方面。主要内容包括但不限于:多线程应用场景及其优劣、线程与进程的区别、线程同步方法、线程池的工作原理及配置、常见并发容器的特点及使用场景、并发队列的分类及常用队列介绍、以及常用的并发工具类。文档旨在帮助开发者深入理解和掌握Java并发编程的关键技术和最佳实践。 适合人群:具备一定Java编程经验的研发人员,尤其是希望深入了解并发编程机制、提高多线程应用性能的中级及以上水平的Java开发者。 使用场景及目标:①帮助开发者理解并发编程的基本概念和技术细节;②指导开发者在实际项目中合理运用多线程和并发工具,提升应用程序的性能和可靠性;③为准备Java技术面试的候选人提供全面的知识参考。 其他说明:文档内容详尽,适合用作深度学习资料或面试复习指南。建议读者结合实际编码练习,逐步掌握并发编程技巧。文中提到的多种并发工具类和容器,均附有具体的应用场景和注意事项,有助于读者更好地应用于实际工作中。
这个数据集包含了日常步数统计、睡眠时长、活跃分钟数以及消耗的卡路里,是个人健康与健身追踪的一部分。 该数据集非常适合用于以下实践: 数据清洗:现实世界中的数据往往包含缺失值、异常值或不一致之处。例如,某些天的步数可能缺失,或者存在不切实际的数值(如10,000小时的睡眠或负数的卡路里消耗)。通过处理这些问题,可以学习如何清理和准备数据进行分析。 探索性分析(发现日常习惯中的模式):可以通过分析找出日常生活中的模式和趋势,比如一周中哪一天人们通常走得最多,或是睡眠时间与活跃程度之间的关系等。 构建可视化图表(步数趋势、睡眠与活动对比图):将数据转换成易于理解的图形形式,有助于更直观地看出数据的趋势和关联。例如,绘制步数随时间变化的趋势图,或是比较睡眠时间和活动量之间的关系图。 数据叙事(将个人风格的追踪转化为可操作的见解):通过讲述故事的方式,把从数据中得到的洞察变成具体的行动建议。例如,根据某人特定时间段内的活动水平和睡眠质量,提供改善健康状况的具体建议。
资源内项目源码是来自个人的毕业设计,代码都测试ok,包含源码、数据集、可视化页面和部署说明,可产生核心指标曲线图、混淆矩阵、F1分数曲线、精确率-召回率曲线、验证集预测结果、标签分布图。都是运行成功后才上传资源,毕设答辩评审绝对信服的保底85分以上,放心下载使用,拿来就能用。包含源码、数据集、可视化页面和部署说明一站式服务,拿来就能用的绝对好资源!!! 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、大作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.txt文件,仅供学习参考, 切勿用于商业用途。
nginx
资源内项目源码是来自个人的毕业设计,代码都测试ok,包含源码、数据集、可视化页面和部署说明,可产生核心指标曲线图、混淆矩阵、F1分数曲线、精确率-召回率曲线、验证集预测结果、标签分布图。都是运行成功后才上传资源,毕设答辩评审绝对信服的保底85分以上,放心下载使用,拿来就能用。包含源码、数据集、可视化页面和部署说明一站式服务,拿来就能用的绝对好资源!!! 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、大作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.txt文件,仅供学习参考, 切勿用于商业用途。
资源内项目源码是来自个人的毕业设计,代码都测试ok,包含源码、数据集、可视化页面和部署说明,可产生核心指标曲线图、混淆矩阵、F1分数曲线、精确率-召回率曲线、验证集预测结果、标签分布图。都是运行成功后才上传资源,毕设答辩评审绝对信服的保底85分以上,放心下载使用,拿来就能用。包含源码、数据集、可视化页面和部署说明一站式服务,拿来就能用的绝对好资源!!! 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、大作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.txt文件,仅供学习参考, 切勿用于商业用途。
模拟知识付费小程序,可流量主运营模式
什么是普通上传 调用接口一次性完成一个文件的上传。 普通上传2个缺点 文件无法续传,比如上传了一个比较大的文件,中间突然断掉了,需要重来 大文件上传太慢 解决方案 分片上传
英二2010-2021阅读理解 Part A 题干单词(补).pdf
2023-04-06-项目笔记-第四百五十五阶段-课前小分享_小分享1.坚持提交gitee 小分享2.作业中提交代码 小分享3.写代码注意代码风格 4.3.1变量的使用 4.4变量的作用域与生命周期 4.4.1局部变量的作用域 4.4.2全局变量的作用域 4.4.2.1全局变量的作用域_1 4.4.2.453局变量的作用域_453- 2025-04-01
微信小程序项目课程设计,包含LW+ppt
GP300单缸液压圆锥破碎机CAD().zip
超实用telnet调试工具,支持重连,命令定时发送,日志存储等。