Reputation: 6289
I am updating some SQL queries as necessary now that we've moved to MariaDB rather than using SQL Anywhere. One line I need to change involves a convert()
operation. The MariaDB syntax for convert()
states that this takes two arguments, the value and the data type - and the data type should be second. So, that being the case, how would I update this line for MariaDB?
CONVERT(a.time_started, 100, CHAR) AS 'Waiting Since',
I tried wrapping the first two in brackets, like so:
CONVERT((a.time_started, 100), CHAR) AS 'Waiting Since',
... but that produced its own error about having one operand.
I'm more familiar with MongoDB than I am with SQL, so I'd also like to understand what the 100
in this line represents.
So what does that represent, and how should this be re-written to work with MariaDB?
Upvotes: 0
Views: 44
Reputation: 521409
From the SAP documentation for CONVERT, the format mask 100
corresponds to the following format mask:
mmm dd yyyy hh:nnAM (or PM)
For example:
Sep 9 2019 2:24PM
We can try may using MariaDB's DATE_FORMAT
as follows:
DATE_FORMAT(a.time_started, '%b %d %Y %r') AS `Waiting Since`
Upvotes: 2