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 |

相关推荐
云技纵横3 分钟前
线上接口突然超时,怎么判断卡在 Nginx、线程池、连接池还是 SQL?
后端·sql·mysql
VALENIAN瓦伦尼安教学设备11 分钟前
ASHOOTER激光对中仪如何通过颜色确定调整是否合适
数据库·嵌入式硬件·算法
Wang's Blog12 分钟前
AI Agent白手起家58: 项目可观测性——用 LangSmith 实现全链路追踪
数据库·人工智能
SL_staff1 小时前
JVS数字底座实践:如何复用企业文档能力快速构建知识类应用
java·数据库·程序员
sugar__salt1 小时前
MyBatis ③动态 SQL 完全指南 —— 从条件拼接到批量操作
java·sql·mybatis
qq_185198691 小时前
SpingBoot3入门学习-Web开发-三
java·数据库·学习
农村小镇哥2 小时前
C#读取CSV文件的方法
服务器·数据库·c#
IMPYLH2 小时前
HTML 的 <embed> 元素
前端·数据库·html
油丶酸萝卜别吃2 小时前
Redis 布隆过滤器快速实现
数据库·redis·缓存
深念Y2 小时前
stable-diffusion.cpp 的 FLUX.2 Klein 9B 分步
java·前端·数据库