select mydate as [date],enter as [Enters], left as [lefts], CAST ( CAST ( DATEDIFF (hour, enter, left) as varchar)+':'+
CAST ( datediff (MINUTE,enter,left)%60 as varchar)
as varchar)as [time realizated] from timer where user='xxxx'
这是我的查询它在sql server中工作但我必须更改数据库才能访问 现在它不起作用我得到了一个人的历史记录
例如
date enters lefts time realizated
29/06/2011 8:00 9:30 1:30
答案 0 :(得分:1)
Date中的DateDiff语法不同。我想:
DateDiff('n',[Enters],[Lefts])
应该在几分钟内给你时间。
如果你想要它可以做的时间:
DateAdd('n',DateDiff('n',[Enters],[Lefts]),#00:00:00#)
答案 1 :(得分:1)
select mydate as [date],enter as [Enters], left as [lefts],
int((left-enter)*24) & ":" & int((left-enter)*1440) mod 60 as [time realizated]
from timer where user='xxxx'
请检查&(concatenate)和int(),因为我不记得这是否是写。 但是我很久以前在访问时使用了很多这种日期配对
所以这里int()表示floor()
你还需要用ceros填充