I'm trying to use multiple date_format conversions from YYYY-MM-DD to DD-MM-YYYY.
When I use one it works:
"SELECT *,
DATE_FORMAT(DOB, '%d-%m-%Y') AS DOB
FROM Basics");
However when I use two it stops working:
"SELECT *,
DATE_FORMAT(DOB, '%d-%m-%Y') AS DOB,
DATE_FORMAT(Shearing-Date, '%d-%m-%Y') AS Shearing-Date
FROM Basics");
I tried this fix but it didn't work: Mysql Multiple use of Date_Format
I also tried AND but that didn't work.
What am I doing wrong? :)
The problem is most likely incorrect identifier:
SELECT *,
DATE_FORMAT(DOB, '%d-%m-%Y') AS DOB,
DATE_FORMAT(`Shearing-Date`, '%d-%m-%Y') AS `Shearing-Date`
FROM Basics
If you are using -
as a part of a name it should be quoted with backtick.