You probably want SEC_TO_TIME:

http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html

SELECT a as start, b as end, SEC_TO_TIME(end - start) FROM table

____________________________________________________________
Eamon Daly



----- Original Message ----- 
From: "Dirk Bremer (NISC)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 11, 2004 1:57 PM
Subject: Date/Time Difference Calculations


> I'm using MySQL version 4.0.18. I have two datetime columns in the same
> table, one that represents a start time and the other that represents an
end
> time. I would like to write a query that will show the difference between
> these two columns in a HH:MM:SS format. The values of the two columns as
> inserted into the table are never be separated by more than a few hours,
but
> could span a day boundary, i.e the start time could be late one day end
the
> end time early the next day, so the date will have to be taken into
> consideration for the calculation. Looking at the docs, it appears that
> version 4.1.x has a lot more date/time functions, but I'm wondering if
> something similar can be arrived at under the version that I am using.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to