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

相关推荐

  1. <span style='color:red;'>SQL</span><span style='color:red;'>查询</span>

    SQL查询

    2024-03-12 03:30:03      14 阅读
  2. SQL查询语句

    2024-03-12 03:30:03       33 阅读
  3. 3. SQL - 查询

    2024-03-12 03:30:03       38 阅读
  4. SQL笔记 -- 查询优化

    2024-03-12 03:30:03       30 阅读
  5. 动态sql,关联查询

    2024-03-12 03:30:03       32 阅读
  6. mysql sql查询

    2024-03-12 03:30:03       39 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-03-12 03:30:03       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-03-12 03:30:03       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-03-12 03:30:03       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-03-12 03:30:03       20 阅读

热门阅读

  1. SpringBoot集成Swagger3.0

    2024-03-12 03:30:03       22 阅读
  2. Linux——信号处理

    2024-03-12 03:30:03       19 阅读
  3. 整站下载保存为mhtml

    2024-03-12 03:30:03       16 阅读
  4. 376. 摆动序列(力扣LeetCode)

    2024-03-12 03:30:03       19 阅读
  5. Redis运行原理及基本数据类型

    2024-03-12 03:30:03       18 阅读
  6. Facebook和Instagram全球宕机,原因未披露

    2024-03-12 03:30:03       28 阅读
  7. 腾讯 后端 一面(115min)

    2024-03-12 03:30:03       18 阅读
  8. Linux收集内存快照来使用crash分析的方法

    2024-03-12 03:30:03       16 阅读
  9. 面试题练习

    2024-03-12 03:30:03       19 阅读
  10. 力扣爆刷第89天之hot100五连刷31-35

    2024-03-12 03:30:03       21 阅读
  11. 二叉树的先序遍历

    2024-03-12 03:30:03       23 阅读
  12. LeetCode每日一题[c++]-找出字符串的可整除数组

    2024-03-12 03:30:03       20 阅读