MySQL Forums
Forum List  »  Newbie

Filter by Year(date)
Posted by: Pedro Camara
Date: November 23, 2022 12:50PM

Hello all. I hope everyone's ok.
I'm trying to filter my table in order to have only records from the last 2 years and the current year.

I did this and it's not working

YEAR (data) >= YEAR (current_date()-2)

Can anyone help me?
Thanks a lot in advance

Options: ReplyQuote

Written By
Filter by Year(date)
November 23, 2022 12:50PM
November 23, 2022 12:57PM
November 23, 2022 09:54PM
November 24, 2022 03:16AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.