Today aI want to share two simple but useful queries to be created in the Users application.
The following where clause will list all active user sessions excluding system:
SELECT * from maxuser WHERE userid in (select userid from maxsession where active=1 and issystem!=1)
I always add a result set on MAXADMIN start center with this query to see how many users are logged on the production environment or how many developers and testers are connected to a development server.
If login tracking is enabled, the where clause below will list all active users that never logged in during the last 100 days:
SELECT * from maxuser WHERE status='ACTIVE' AND sysuser=0 AND userid NOT IN (select userid from LOGINTRACKING where ATTEMPTDATE>sysdate-100 AND attemptresult='LOGIN')
This is very useful to spot user accounts to be deleted or deactivated.