On 12/3/02 10:45 AM, Peter Abilla ([EMAIL PROTECTED]) wrote:

> Suppose I have a datetime in the following format:
> 
> Column One              Column Two
> 1999-09-17 16:30:18     1999-09-18 13:30:18
> 
> I want to calculate the minutes like
> 
> (Column Two - Column One) = Total Minutes
> 
> I've scoured the mysql site and haven't found something that addresses this.
> Any ideas?
> 
> Keyword: sql, query

What about using:

select (unix_timestamp(col2) - unix_timestamp(col1))/60 as total;

Using your values:

mysql> select (unix_timestamp('1999-09-18 13:30:18') -
unix_timestamp('1999-09-17 16:30:18'))/60 as total;

+---------+
| total   |
+---------+
| 1260.00 |
+---------+
1 row in set (0.00 sec)

Pablo


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to