Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

240
Views
postgresql query in comparing dates with duration stored in other column

I have a table like

------------------------------
id | created_date | duration 
------------------------------

duration is no.of days, now I want to select records that are created_date(timestamp)+duration(integer) > current time

I tried this in my where clause

 "select * from table where (created_date + duration days) > now()"

now resultset is empty, I have records that should come out for my requirement, I suspect my query is not right, help me get it right.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Very close. I would do this as:

select *
from table
where created_date > now() - duration * interval '1 day'
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!