Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL Query: Query All Entries Older Than 1 Year

Tags:

mysql

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!

like image 641
Benjamin Morrison Avatar asked Sep 01 '25 11:09

Benjamin Morrison


1 Answers

You can do something like:

select * from `members` 
  where `paymentDate` < DATE_SUB(CURDATE(), INTERVAL 1 YEAR)
  and `AwaitingRenewal` = 'NO'
like image 82
Brian Hoover Avatar answered Sep 04 '25 00:09

Brian Hoover