SQL to get the Number of users connected to the environment in last 30 days.

 SELECT TO_CHAR(A.LOGINDTTM,'YYYY-MM-DD'),count(distinct A.OPRID) "Users"
      FROM PSACCESSLOG A
     WHERE TO_CHAR(A.LOGINDTTM,'YYYY-MM-DD') >= TO_CHAR(SYSDATE - 30,'YYYY-MM-DD')
     GROUP BY TO_CHAR(A.LOGINDTTM,'YYYY-MM-DD')
     ORDER BY TO_CHAR(A.LOGINDTTM,'YYYY-MM-DD') DESC;

Comments

Popular posts from this blog

BI Publisher: If Condition with sub-string in rtf template