Well I need to update my accounts that are over 5 months old, I wanted to do this right in mysql. The update looks like this:
UPDATE contas
SET baixa_valivade = true
WHERE data_vencimento (Preciso verificar se já esta vencida a mais de 5 meses)
Well I need to update my accounts that are over 5 months old, I wanted to do this right in mysql. The update looks like this:
UPDATE contas
SET baixa_valivade = true
WHERE data_vencimento (Preciso verificar se já esta vencida a mais de 5 meses)
Use DATE_ADD () :
UPDATE contas
SET baixa_valivade = true
WHERE data_vencimento BETWEEN DATE_ADD(CURRENT_DATE(), INTERVAL -5 MONTH) AND CURRENT_DATE()
If the need is to update items with a delay date greater than 5 months, the code would look like this:
UPDATE contas
SET baixa_valivade = true
WHERE data_vencimento < DATE_ADD(CURRENT_DATE(), INTERVAL -5 MONTH)