如何在表中查找连续数据。 [英] How to find consecutive data in table.
本文介绍了如何在表中查找连续数据。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在表格中有很多数据。喜欢这个
没有ID
1 001
2 001
3 001
1 002
3 002
4 002
5 002
我想要通过No filed和ID组连续3个数据。喜欢这个
没有ID
1 001
2 001
3 001
3 002
4 002
5 002
所以如何为这个问题编写SQL语句。
I have a lot of data in table. like this
No ID
1 001
2 001
3 001
1 002
3 002
4 002
5 002
I want to 3 consecutive data by No filed and by group of ID. like this
No ID
1 001
2 001
3 001
3 002
4 002
5 002
so how to write SQL statement for this problem.
推荐答案
试试这些 -
连续统计日期使用SQL [ ^ ]
http://bytes.com/topic/sql-server/answers/861048-how-find-x-consecutive-integer-values-table-column [ ^ ]
http://ask.sqlservercentral.com/questions/17524/how-to-find-records-with-3-consecutive-same-values.html [ ^ ]
Try these -
Counting Consecutive Dates Using SQL[^]
http://bytes.com/topic/sql-server/answers/861048-how-find-x-consecutive-integer-values-table-column[^]
http://ask.sqlservercentral.com/questions/17524/how-to-find-records-with-3-consecutive-same-values.html[^]
这篇关于如何在表中查找连续数据。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文