I would like to know how to do calculations with dates in Mysql.
Table:
ID | DataValidade (DATETIME)
1 | 2017-01-01 00:00:00
2 | 2017-05-01 00:00:00
3 | 2016-06-01 00:00:00
I need to return records whose expiration date is 30 days from today's date. I need to return records whose expiration date is between periods.
I did
SELECT * FROM tabela where DATE_SUB(DataValidade, 30)
but is returning error #1064
Can anyone help me or send links where I have good examples that I can study regarding operations with mysql dates?