CREATE TABLE `incoming` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`dt_first` datetime DEFAULT NULL,
`dt_second` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8
您需要选择日期差异之间最大值的 id:
MAX(unix_timestamp(dt_first)-unix_timestamp(dt_second))
1 个回答