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 |
原文地址:https://blog.csdn.net/bluecard2008/article/details/136480626
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!