Skip to content
Advertisement

the select convert function not working ! Return the syntax error?

I am using DBeaver. Here is my piece of code:

select convert(varchar(10), updated_at, 101)
from rewards.mission_actions
limit 30

This is the error:

[42601]: ERROR: syntax error at or near “,”

Because the data is too specific to extend of hour and minute so I want to change it. Not extract details out of it.

Please help or at least give me another solution.

Advertisement

Answer

The CONVERT function is for SQL Server, not MySQL. The closest analog in MySQL would be DATE_FORMAT:

SELECT DATE_FORMAT(updated_at, '%m/%d/%Y')
FROM rewards.missions_actions
-- ORDER BY <something>
LIMIT 30
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement