I have a MYSQL database and I need a SQL that looks at the DAY OF PAYMENT in the DIA field (this field will only have the DAY of the month that the client chose to make the payment, this field is of type INT) and show me some less than 5 days before the payday. Of course this DAY field will be based on the day of the current date.
I have this code:
Select * from conta where DAYOFMONTH(CURDATE()) - 5 = dia;
Only that it does not work, because it only shows the records that are missing 5 days to the due date, that is, if 4 days is missing, 03 days, 02 days, 01 day it does not show anything. I need something that always shows some result when less than 5 days to maturity.