It is possible to use MOD in WHERE clause.
If timestamp is stored as seconds it could be
... WHERE MOD(timestamp, 300) = 0...
to check if seconds number is divisible by 60*5.
Your code looks like SQL Server. You can check that the timestamp
meets your conditions using datetimefromparts()
and
select top (100000) [timestamp], [value] as fi500
from X
where timestamp = datetimefromparts(2019, 11, 05,
datepart(hour, timestamp),
(datepart(minute, timestamp) / 5) * 5,
0, 0
)
order by timestamp;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.