sql 查询

连续区域取数

select sid,min(b.eid) as eid from

(select id+2 as sid from txtTempTable where tc1 like 'Name*') as a,

(select id as eid from txtTempTable where tc1='Page') as b

where sid<b.eid

group by sid

16,18, 22,23

|----|-----|-----|
| id | tc1 | tc2 |
| 16 | | |
| 17 | | |
| 18 | | |
| 22 | | |
| 23 | | |

两表对应关联

select aa.sid,aa.eid,

(select top 1 tc2 from txtTempTable where tc1 like "Analyte*" and id>aa.sid-14 and id<aa.eid)

as xmmc from

(

select sid,min(b.eid) as eid from

(select id+2 as sid from txtTempTable where tc1 like 'Name*') as a,

(select id as eid from txtTempTable where tc1='Page') as b

where sid<b.eid

group by sid

) as aa

|-----|-----|-----|
| sid | eid | mc |
| 16 | 18 | f01 |
| 22 | 23 | f02 |

相关推荐
xcjbqd05 分钟前
Python中Pandas如何将DataFrame写入MySQL_使用to_sql函数
jvm·数据库·python
ZOOOOOOU7 分钟前
智慧社区云对讲门禁系统架构设计:中优云联免布线、全免费核心功能技术解析
数据库·人工智能·架构·边缘计算
Francek Chen9 分钟前
【大数据存储与管理】NoSQL数据库:02 NoSQL兴起的原因
大数据·数据库·分布式·nosql
weixin_7042660513 分钟前
读取Excel 和 显示预约人数
spring boot·mybatis·excel
斌味代码14 分钟前
RAG API 接入:从注册到生产级应用的10分钟上手指南
数据库·oracle
送秋三十五15 分钟前
Spring 源码---------Spring Core
java·数据库·spring
Cat_Rocky19 分钟前
redis数据库基础学习
数据库·redis·学习
正在走向自律21 分钟前
多源异构数据融合技术实践:GIS、时序、文档与缓存数据整合方案
数据库
武超杰44 分钟前
MySQL调优(一)
数据库·mysql
电商API&Tina1 小时前
淘宝 / 京东关键词搜索 API 接入与实战用途教程|从 0 到 1 搭建电商选品 / 比价 / 爬虫替代系统
java·开发语言·数据库·c++·python·spring