mysql 查询返回意外。我正在尝试连接一些包含日期查询的字符串,如下所示:
mysql> select month(timestamp) +'-'+ day(timestamp) + '-' +
year(timestamp) as date FROM table ORDER BY timestamp DESC LIMIT 1;
我得到一个 4 位数的结果,我认为这是预期结果的总和:
+------+
| date |
+------+
| 2035 |
+------+
我也尝试过将每个都设置为CHAR
不起作用:
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;
有人可以让我知道我做错了什么吗?...我想如何解决它也会很好:)