mysql查詢返回意外。我試圖串連像弦數含日期查詢,以便:連接日期函數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;
可能有人讓我知道我做錯了嗎? ......我想如何解決這將是很好過:)
'+'是[加法運算] (http://dev.mysql.com/doc/refman/5.0/en/arithmetic-functions.html#operator_plus)(但在MSSQL中用於字符串連接)。 –