I'm practically newbie with MySQL.
I'm trying to do a query to retrieve a preformatted date, obtained from a subtraction, using CONVERT
.
This is the query:
sql = f"SELECT CONVERT(timestamp - {sqlToday}, getdate(), 23), count_issue FROM total_unresolved_issue WHERE project = '{project}'"
timestamp
is a column of the database, and sqlToday
is a date in format datetime.date(2020, 2, 13)
.
Unfortunately this error returns, and I don't know how to handle it:
mysql.connector.errors.ProgrammingError: 1064 (42000): 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 'getdate(), 23), count_issue FROM total_unresolved_issue WHERE project = 'Graphic' at line 1
Thanks in advance!
NOW()
. It works very well, thanks @danblack! I found the convert documentation here. But at this point I believe it is totally incomplete.