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:>
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
Post a Comment