56,678
社区成员
发帖
与我相关
我的任务
分享
CREATE TABLE `test_time` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`startdate` varchar(20) DEFAULT NULL,
`starttime` varchar(20) DEFAULT NULL,
`updateTime` datetime DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of test_time
-- ----------------------------
INSERT INTO `test_time` VALUES ('1', '20160310', '09:10:22', null);
INSERT INTO `test_time` VALUES ('2', '20160311', '22:23:31', null);
mysql> select cast(concat(date_format(cast(startdate as date),'%Y-%m-%d'),' ', starttime) as datetime) from test_time;
+------------------------------------------------------------------------------------------+
| cast(concat(date_format(cast(startdate as date),'%Y-%m-%d'),' ', starttime) as datetime) |
+------------------------------------------------------------------------------------------+
| 2016-03-10 09:10:22 |
| 2016-03-11 22:23:31 |
+------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)