如何获取derby db上2 datetimestamp之间的时差? [英] How to get the hour difference between 2 datetimestamp on derby db?
本文介绍了如何获取derby db上2 datetimestamp之间的时差?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在derby数据库上有一个SQL问题:
I have a sql question on derby database:
Select a.name, a.starttime, a.endtime
From a
如何添加到上面的sql语句中,这样我就可以开始时间和结束时间之间的几小时? (我只知道对于mysql有DATEDIFF函数,但是我不确定应该为derby db使用什么函数)
How can I add to the above sql statement such that I can get the difference in hours between the start time and end time? (I only know that for mysql there is a DATEDIFF function, but I am not sure about what function should I use for derby db)
谢谢。
推荐答案
在德比中,有一个TIMESTAMPDIFF:
In Derby there is a TIMESTAMPDIFF:
例如:
select {fn timestampdiff(SQL_TSI_FRAC_SECOND, startdate, enddate)} as diff
这篇关于如何获取derby db上2 datetimestamp之间的时差?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文