嗨,我有一个包含以下列的MySql表;将多个字段转换为DateTimeStamp
Year Month Day Time Temp
------------------------
2014 12 30 23.5 15.9
2014 12 31 00.0 13.2
2014 12 31 00.5 11.5
上面的数据是30分钟(半小时记录)。
Structure:
----------
Year = int(4)
Month = int(2)
Day = int(2)
Time = decimal(3,1) "decimal 24hrs"
Temp = decimal(3,1)
我需要查询表返回;
Timestamp Date/Time and Temp;e.g.
---------------------------------
2014-12-30 23:30:00 15.9
2014-12-31 00:00:00 13.2
2014-12-31 00:30:00 11.5
我可以返回日期部分(和温度),但无法转换/包含时间。
我目前正在使用;
SELECT concat(`Year`,'-',`Month`,'-',`Day`) AS `MyDateTimeStamp`, `Temp`
FROM `MyTable'
我找遍了线索,找不到类似的例子。 谢谢你在前进, 问候 托尼
为什么不试试'SEC_TO_TIME()'? (查看下面的答案) – Barranka 2014-09-06 00:11:49