A mysql query is returning unexpected. I'm trying to concatenate a few strings containing date queries like so:
mysql> select month(timestamp) +'-'+ day(timestamp) + '-' +
year(timestamp) as date FROM table ORDER BY timestamp DESC LIMIT 1;
and I'm getting a 4 digit result, which I assume is the sum of the expected result:
+------+
| date |
+------+
| 2035 |
+------+
I've also tried casting each one as CHAR which didn't work:
mysql> select CAST(month(timestamp) as CHAR) +'-'+ CAST(day(timestamp) as CHAR) + '-' +
CAST(year(timestamp) as CHAR) as date FROM table ORDER BY timestamp DESC LIMIT 1;
Could someone let me know what I'm doing wrong? ... and I guess how to fix it would be nice too :)
+is the addition operator (but works in MSSQL for string concatenation).