2
Good morning guys, this is a part of query which I used to search the last days from the current date. It works as expected when I put -20, but by putting -30, nay.
WHERE viacao_os.creation_date BETWEEN CURRENT_DATE() -30 AND CURRENT_DATE()
How can I consult what was created in the last 30 days?
WHERE viacao_os.creation_date BETWEEN DATE_ADD(CURRENT_DATE() INTERVAL -30 DAY) AND CURRENT_DATE() Order by viacao_os.os_id
– user107357
Made that mistake
– user107357
@user107357, missing a comma in the
date_add
. Fix it, try again.– rLinhares
Presented this error 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 'INTERVAL -30 DAY) AND CURRENT_DATE() Order by viacao_os.os_id
– user107357
Thank you, it worked right, very grateful.
– user107357
mass :) just remember to mark the answer as accepted ;)
– rLinhares