MySQL Query: Query All Entries Older Than 1 Year

谁都会走 提交于 2020-01-02 07:28:30

问题


I am putting together a membership database for a nonprofit charity in LibreOffice, but have no experience in mysql queries so I would appreciate the help.

I am trying to create a query that displays all records where the membership signup date field (PaymentDate) is older than 1 year of the current date AND a boolean value of another field (AwaitingRenewal) is NO. The date is in 05/03/85 format. Thanks for any help you can give me!


回答1:


You can do something like:

select * from `members` 
  where `paymentDate` < DATE_SUB(CURDATE(), INTERVAL 1 YEAR)
  and `AwaitingRenewal` = 'NO'



回答2:


* from dt_tb where `dt` >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR)



回答3:


Solved: Older mysql syntax required.



来源:https://stackoverflow.com/questions/12736092/mysql-query-query-all-entries-older-than-1-year

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!