CREATE TABLE Test (
id int primary key,
Present varchar(10),
Date date,
Time time
);
INSERT INTO Test (id, Present, Date, Time)
Values (1, 'Present', '2018-07-18', '10:13:55' ),
(2, 'Present', '2018-07-18', '10:10:55' );
查询:
SELECT
id,
Present,
Date,
Time,
current_time AS 'Current Time',
TIMESTAMPDIFF(MINUTE, [Time], CURRENT_TIME()) AS 'Current Time'
FROM Test
我想找出时间1和当前时间(以分钟为单位)之间的差异。我不断得到一个错误,所以我假设这可能是一个转换问题,但我不能找出它。
小提琴:http://sqlfiddle.com/#!9/486850/47
有人能给我建议吗?谢谢
2条答案
按热度按时间yacmzcpb1#
我猜你的化名让你很难受
3npbholx2#
您可以尝试此查询:
此处演示