简体   繁体   中英

How to make query in postgresql which will find all records which are started more than 6 hours?

How to make query in postgresql which will find all records which are started more than 6 hours ago?

In my table I have a column which stores utc time of last time used in milliseconds (long integer).

SELECT *
FROM exams
WHERE started < HERE_I_NEED_UTC_IN_MILLISECONDS - 6 * 60 * 1000 * 1000;
select *
from exams
where started < extract(epoch from (current_timestamp - interval '6' hour))

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM