query to find difference between two time data record
I have a table that contains the following datetime and customer
example :
data1 :
datetime : 2011-7-25 10:23:30 AM customer:A data2 :datetime : 2011-7-25 10:40:30 AM customer:BI need query to know tim开发者_开发知识库e duration between Customer A and B,
I am using Firebird database. thank you before
What about DATEDIFF
?
SELECT DATEDIFF(second, -- or the unit you want
a.datetime, b.datetime) AS result
FROM ExampleTable a, ExampleTable b
WHERE a.customer = 'A' and b.customer = 'B'
精彩评论