Home > Software engineering >  SQL Add One Day To Query Date
SQL Add One Day To Query Date

Time:04-04

I would like to add one day to query date, then get all the data greater than today.

Fields: valid_to

Table: Post

Select * from posts where valid_to   1 > Now()

CodePudding user response:

The Postgres SQL you want here is:

SELECT * FROM posts WHERE valid_to   interval '1' day > NOW();

As for the logic, it is not clear this is the query you need without seeing some sample data.

  • Related