程式碼
SELECT HOU.ORGANIZATION_ID
, HOU.NAME ORGANIZATION_NAME
, COUNT(*) ONLINE_NUM
FROM (SELECT DISTINCT
RESPONSIBILITY_ID
, USER_ID
FROM FND_SIGNON_AUDIT_VIEW
) A
, ORG_ACCESS OA
, HR_ALL_ORGANIZATION_UNITS_TL HOU
WHERE A.RESPONSIBILITY_ID = OA.RESPONSIBILITY_ID(+)
AND OA.ORGANIZATION_ID = HOU.ORGANIZATION_ID(+)
GROUP BY HOU.NAME, HOU.ORGANIZATION_ID;