Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 4729

SQL Server is not retrieving data for every 15 min interval of time

$
0
0

Hi All,

I have a query to return the rows starting with min timestamps and giving 15 min time interval between. This query is retieving results but if the first timestamp is retrieving some value which is not divided by 15 it displays the second row which is divisible by 15 and from there it gives 15min time interval. But I need the timestamp to be displayed by 15min each starting from first row:

My query is looks as:

  

SELECT(SELECTCONVERT(VARCHAR(16),MIN([col1]),120))ASRextFROM table1wherecolum3 = '%hght%'

GROUPBYDATEPART(YEAR,[col1]),DATEPART(MONTH,[col1]),DATEPART(DAY,[col1]),

DATEPART(HOUR,[col1]),(DATEPART(MINUTE,[EVT_TS])/15)  ORDERBYRext

Result as:

Rext
2019-07-19 06:59
2019-07-19 07:00
2019-07-19 07:15
2019-07-19 07:30
2019-07-19 07:45
2019-07-19 08:00
2019-07-19 08:15
2019-07-19 08:30
2019-07-19 08:45
2019-07-19 09:00

But expected result as:

2019-07-19 06:59
2019-07-19 07:14
2019-07-19 07:29
2019-07-19 07:44
2019-07-19 07:59
2019-07-19 08:14
2019-07-19 08:29
2019-07-19 08:44
2019-07-19 08:59
2019-07-19 09:14

Could someone help me resolve this issue


Viewing all articles
Browse latest Browse all 4729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>