List:General Discussion« Previous MessageNext Message »
From:Rick James Date:June 20 2012 5:22pm
Subject:RE: Need Query Help
View as plain text  
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_akarmarkar@stripped]
> Sent: Wednesday, June 20, 2012 2:39 AM
> To: mysql@stripped
> 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
Thread
Need Query HelpAnupam Karmarkar20 Jun
  • RE: Need Query HelpRick James20 Jun
    • Re: Need Query HelpAnupam Karmarkar22 Jun
      • Re: Need Query HelpShawn Green22 Jun