0

I have a table:

For example current date 04/02/2020

  id   |   last_update   | update_frequency(days)
--------------------------------------------------
   1    |   01/02/2020   |   2
   2    |   01/02/2020   |   1
   3    |   01/02/2020   |   5

I would like to make a single query that will return ids to update.

   id   |
---------
    1
    2
2
  • So you want to update or select ids to update? There is a mismatch between title and the question itself. Commented Feb 15, 2020 at 10:43
  • @Ruslan . . . Please explain the rules for returning the rows you want. Commented Feb 15, 2020 at 12:49

1 Answer 1

1

You can use the following:

select id
from table_name
where extract('day' from (last_update - current_date)) >= update_frequency
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.