我想确定某个特定分区是否重复了一组n个连续数字。
假设我有deviceIds
和一些recordid
,它们的值是连续的,设备生成的每个记录都增加1。
所以我想知道是否重置recordid
并再次以相同的顺序重新生成记录。让我们通过下表来了解。
Device ID recordid DateTime
--------------------------------------------------
07777778999 2 18-12-2016 17:15
07777778123 10 18-12-2016 18:10
07777778123 10 18-12-2016 18:20
07777778999 3 19-12-2016 19:30
07777778999 4 19-12-2016 12:15
07777778999 5 19-12-2016 13:15
07777778999 6 20-12-2016 11:15
07777778123 11 20-12-2016 9:15
07777778123 12 20-12-2016 17:15
07777778123 13 20-12-2016 17:25
07777778123 14 20-12-2016 17:35
07777778999 7 20-12-2016 17:45
07777778999 8 20-12-2016 17:55
07777778999 4 20-12-2016 18:50
07777778999 5 20-12-2016 18:55
07777778999 6 20-12-2016 18:50
07777778999 7 20-12-2016 18:55
...
有许多设备,因此我们可以按设备对它进行分区,然后应用查询来查找某个设备是否重新生成了数字,例如07777778999,我们记录了ID为2,3,4,5,6,7 ,8,然后从4,5,6,7等生成数字。
所以我想列出所有使用SQL进行再生的设备。 因此,上面的预期输出将是设备07777778999
答案 0 :(得分:0)
尝试一下。
这将返回所有具有重新生成的值的记录。
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<script src="script.js"></script>
<title>test area</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=" style.css">
</head>
<body>
<div id="slideshow">
<div>
<img src="//farm6.static.flickr.com/5224/5658667829_2bb7d42a9c_m.jpg">
</div>
<div>
<img src="//farm6.static.flickr.com/5230/5638093881_a791e4f819_m.jpg">
</div>
<div>
Pretty cool eh? This slide is proof the content can be anything.
</div>
</div>
</body>
</html>