views:

105

answers:

1

Hi,

I have a sql question on derby database:

Select a.name, a.starttime, a.endtime
From a

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)

Thanks.

+1  A: 

In Derby there is a TIMESTAMPDIFF:

for instance:

select {fn timestampdiff(SQL_TSI_FRAC_SECOND, startdate, enddate)} as diff 

regards,
Stijn

TheStijn