Insert the following clause into the WHERE:
DATEPART(MINUTE,[CAMPO DATA]) % 10 < 5
Explaining what is being done: I am isolating last digit of the minute of your datetime field and checking whether it is contained in {0,1,2,3,4}.
With this I believe will return the expected values.
Example (items will be returned in bold:
- 30/01/2018 08:00
30/01/2018 08:05
30/01/2018 08:11
30/01/2018 08:17
30/01/2018 08:23
30/01/2018 08:28
30/01/2018 08:33
30/01/2018 08:38
The table has only two fields:
datahora (datetime) tag (varchar(30)
Table content:
date tag
2016-04-01 00:01:03.580 PDT_1_T13@PV
2016-04-01 00:06:03.580 PDT_1_T13@PV
2016-04-01 00:11:03.580 PDT_1_T13@PV
2016-04-01 00:16:03.580 PDT_1_T13@PV
2016-04-01 00:21:03.580 PDT_1_T13@PV
If the selection is 01-04-2016 00:00:00 until 01-04-2016 00:35:00
Break of 10 minutes.
Expected Departure
date tag
2016-04-01 00:01:03.580 PDT_1_T13@PV
2016-04-01 00:11:03.580 PDT_1_T13@PV
2016-04-01 00:21:03.580 PDT_1_T13@PV
example of data ? example of how you want the output ? table structure ? use Sqlfiddle if possible
– Rovann Linhalis
The table has only two fields: date (datetime), tag (varchar(30). time tag 2016-04-01 00:01:03.580 PDT_1_T13@PV 2016-04-01 00:06:03.580 PDT_1_T13@PV 2016-04-01 00:11:03.580 PDT_1_T13@PV 2016-04-01 00:16:03.580 PDT_1_T13@PV 2016-04-01 00:21:03.580 PDT_1_T13@PV 2016-04-01 00:26:03.580 PDT_1_T13@PV 2016-04-01 00:31:03.580 PDT_1_T13@PV 2016-04-01 00:36:03.580 PDT_1_T13@PV
– Sergio Paiva
What is the database manager?
– José Diz