久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

從相隔小于指定分鐘數(shù)的行中選擇非重復(fù)值

Select non duplicate values from rows that are less than a specified number of minutes apart(從相隔小于指定分鐘數(shù)的行中選擇非重復(fù)值)
本文介紹了從相隔小于指定分鐘數(shù)的行中選擇非重復(fù)值的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我有一張大表,格式如下:

I have a huge table with the following format:

DATETIME                   NUMBER
--------------------------------------
2009-03-31 16:05:52.000    2453651622
2009-03-31 16:16:12.000    30206080
2009-03-31 16:16:16.000    16890039
2009-03-31 16:16:28.000    2452039696
2009-03-31 16:16:33.000    140851934
2009-03-31 16:16:51.000    2453120306
2009-03-31 16:16:57.000    2453120306
...
2009-04-01 21:15:24.000    2453651622

如果第二列中沒有重復(fù)數(shù)字的行相隔不到 15 分鐘,我該如何選擇它們?

How can I select the rows that don't have duplicate numbers in the second column if they occur less than 15 minutes apart?

在前面的示例中,編號為 2453120306 的第二行是重復(fù)的,因為它與前一行的間隔小于 15 分鐘,不應(yīng)被選中.

In the previous example, the second row with number 2453120306 is a duplicate because it is less than 15 minutes apart from the previous one, and should not be selected.

最后一行與第一行的編號相同,但它不是重復(fù)的,因為它發(fā)生在超過 24 小時之后.

The last row has the same number as the first row, but it is not a duplicate because it occurs more that 24 hours later.

推薦答案

-- distinct required in case there are rows with 
-- exactly the same values for datetime and number
SELECT DISTINCT a.*
FROM your_table AS a
    LEFT JOIN your_table AS b
        ON a.[number] = b.[number]
            AND a.[datetime] > b.[datetime]
            AND a.[datetime] <= DATEADD(minute, 15, b.[datetime])
WHERE b.Number IS NULL

這篇關(guān)于從相隔小于指定分鐘數(shù)的行中選擇非重復(fù)值的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Converting Every Child Tags in to a Single Column with multiple Delimiters -SQL Server (3)(將每個子標記轉(zhuǎn)換為具有多個分隔符的單列-SQL Server (3))
How can I create a view from more than one table?(如何從多個表創(chuàng)建視圖?)
Create calculated value based on calculated value inside previous row(根據(jù)前一行內(nèi)的計算值創(chuàng)建計算值)
How do I stack the first two columns of a table into a single column, but also pair third column with the first column only?(如何將表格的前兩列堆疊成一列,但也僅將第三列與第一列配對?) - IT屋-程序員軟件開發(fā)技
Recursive t-sql query(遞歸 t-sql 查詢)
Convert Month Name to Date / Month Number (Combinations of Questions amp; Answers)(將月份名稱轉(zhuǎn)換為日期/月份編號(問題和答案的組合))
主站蜘蛛池模板: 国产乱码精品1区2区3区 | 亚洲欧美日韩高清 | 日本黄色影片在线观看 | 91精品国产91久久久久游泳池 | 精品一二三区在线观看 | 日韩精品一区二区三区在线播放 | 成人福利在线 | 99国产在线 | 久久国产高清视频 | 国产精品成人在线观看 | 超碰高清| 欧美精品乱码久久久久久按摩 | 久久综合狠狠综合久久综合88 | 99国产精品99久久久久久粉嫩 | 日韩免费av网站 | 国产亚洲欧美另类一区二区三区 | 性生生活大片免费看视频 | 亚洲天堂av网 | 午夜成人免费视频 | 二区国产 | www国产精品 | 天天久 | 国产最新精品视频 | 亚洲网站在线观看 | 91综合网 | 亚洲国产成人在线 | 久久久久久国产免费视网址 | 中文字幕在线一区二区三区 | 国精产品一区二区三区 | 中文字幕在线观看第一页 | 久久影音先锋 | 欧美午夜精品理论片a级按摩 | 国产视频1区2区 | 999久久久 | 天天天天操 | 乳色吐息在线观看 | 黄色在线观看网址 | 亚洲成人福利在线观看 | av毛片在线播放 | 成人免费视频在线观看 | 久久精品色欧美aⅴ一区二区 |