Loading...
March 10, 2011#

SQL for pulling out recent logins

Some SQL for pulling out usernames and last login dates from the db, most recent first…

All users (from any user group)

SELECT user_id, email, login, FROM_UNIXTIME(last_visit_timestamp) 
FROM ezuser 
JOIN ezuservisit ON (ezuser.contentobject_id=ezuservisit.user_id) 
ORDER BY last_visit_timestamp DESC

From a specific user group

You’ll need to update the path_identification_string in the inner query with the user group to look up:

SELECT user_id, email, login, FROM_UNIXTIME(last_visit_timestamp)
FROM ezuser JOIN ezuservisit ON (ezuser.contentobject_id=ezuservisit.user_id)
WHERE ezuser.contentobject_id IN (SELECT contentobject_id FROM ezcontentobject_tree WHERE path_identification_string LIKE "%/administrator_users/%")
ORDER BY last_visit_timestamp  DESC

Leave a Comment