2
I have the following query:
select
ADDDATE(LAST_DAY(SUBDATE(CURDATE(), INTERVAL 1 MONTH)), 1) primeiro_dia,
last_day(sysdate()) ultimo_dia
That returns me the first and last day of the current month according to the date of the system. How could return the first and last day of the previous month according to the date of the system also?
Ta giving error when running your SQL @rLinhares
– R.Santos
@R.Santos what the mistake?
– rLinhares
Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')), 1) primeiro_dia_mes_passado, last_day(DATE_SUB(curdate(), INTERVAL 1 MONTH)' at line 4
– R.Santos
had an extra parenthesis, now it’s okay.
– rLinhares
Ah closed all, already mark as correct :)
– R.Santos