http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_timediff
and SEC_TO_TIME()/3600

> -----Original Message-----
> From: Anupam Karmarkar [mailto:sb_akarmar...@yahoo.com]
> Sent: Wednesday, June 20, 2012 2:39 AM
> To: mysql@lists.mysql.com
> Subject: Need Query Help
> 
> Hi All,
> 
> I need query help for following table struture, where we need to
> calculate login duration of that employee for give period.
> 
> Example table
> 
> 
> EmployeeID     LoginTime                       LogoutTIme
> 
> 101                 2012-05-01 10:00:00     2012-05-01 12:30:00
> 102                 2012-04-31 23:00:00      2012-05-02 05:00:00
> 
> 103                 2012-05-01 14:00:00      NULL
> 104                 2012-05-02 00:10:00      2012-05-02 05:00:00
> 
> 
> I tried to fit all scenario in above table, Consider NULL as yet to
> logout
> 
> 
> How would i calcuate Employee and it Login duration for period say from
> 2012-05-01 08:00:00 to 2012-05-01 22:00:00
> 
> 
> --Anupam

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

Reply via email to