Calculate Time Diff between different column and row [MYSQL] -


A user is trying to calculate time difference in logout / logout, to do this, Required: 2 Login - 1 Logout, I do not even know how to properly understand, so I will tell the results of the table here:>

 Enter image details here

you do this Can you join the table with yourself? Not. This query renders the table that you've posted:

  SELECT t.login, t.logout, TIMEDIFF (MIN (t2.login), T. Logout) my_table Join T LEFT my_table T2 ON Logout & lt; T2.Login GROUP by t.Logout   

MIN (T. Login) The next login after t.Logout is

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -