简体   繁体   中英

Query records with date greater than 60 days

I am trying to query all records that have a date that is greater than 60 days of its created date and also has a null value in another field "Invoice#" The "Date_Created" field is saved as a date in YYYY-MM-DD. This is currently hat I am using but doesn't seem to be working. I get an error saying "Invoice_Number" is an unknown column and when I remove that part of the code I get nothing returned.

select * from PO_Information where Date_Created >= (Date_Created + Interval 60 day) and Invoice_Number IS NULL

WHERE Date_Created >= DATE_ADD(Date_Created,INTERVAL 60 DAY)

For the interval, but This will always return false, this is why you are getting no results when you remove the IS NULL

as for the unknown column, you have not told us about the table structure so I can't help you there

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