2

I have table structure as follows

id name point last_updated refresh_frequency
1 'abc' 100 2015-08-28 01:00:00 24

last_updated is datetime field and refresh_frequency is int

I want to get all rows which having last_updated value before refresh_frequency (in Hours) from current time, How to write a query for this?

1
  • Please review the answers given below. Commented Aug 3, 2015 at 6:28

1 Answer 1

2
SELECT *
FROM tablename
WHERE last_updated < NOW() - refresh_frequency * INTERVAL '1 hour';
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.