简体   繁体   中英

Manipulating Current_Date

Here is my SQL query:

select id, max(file_uploaded_at) as latest_date, current_date
from employee_imports
where convert(file_uploaded_at) - integer '90'< current_date AND
error_message IS NULL
group by id
order by latest_date DESC

I keep getting back values that are older than 90 days though. Do you know why?

select id, max(file_uploaded_at) as latest_date, current_date
from employee_imports
where current_date - date(file_uploaded_at) <= 90 AND
error_message IS NULL
group by id
order by latest_date DESC

This is what I changed my query to and everything appears to work fine.

Thanks anyway guys.

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