1) For example, to get a list of all users listed in Site Users but have never logged into a project before, you have to query both the SESSIONS_HISTORY and USERS tables.
SELECT USER_NAME FROM USERS WHERE USER_NAME NOT IN (SELECT DISTINCT USER_NAME FROM SESSIONS_HISTORY);
This query will return a list of inactive users or users who have not logged into Quality Center.
START_TIME column in SESSIONS_HISTORY table stores the time stamp for the start of the session. This can be used to get a list of users in USERS table who have not logged in recently.
2) For example, to retrieve a list of users who have logged in the past but have not done so since May 1 2009, you can run the following query in Oracle:
select distinct USER_NAME from td.users where USER_NAME not in(SELECT DISTINCT USER_NAME FROM td.SESSIONS_HISTORY WHERE START_TIME >=(select cast('2009-05-01' as datetime)))