0

I have 3 columns in table which are Id(int) , Value(int) and Time(datetime). I want query that get data(s) for 1st 10 mins then 2nd set of 10 mins and continued on..

Afiqah
  • 11
  • 1
  • 4
  • 1
    Possible duplicate of [How to group time by hour or by 10 minutes](http://stackoverflow.com/questions/5002661/how-to-group-time-by-hour-or-by-10-minutes) – jdphenix Sep 07 '16 at 03:30

1 Answers1

2

You can use

DATEDIFF ( datepart , startdate , enddate )

Your Query should be like

SELECT id, value, Time FROM Table 
WHERE DATEDIFF(MINUTE, Time, GETDATE()) <= 10
Mohit Dagar
  • 522
  • 6
  • 21