Assignment interval counts per license name
CREATE VIEW vwlicensecountsbytype AS (
SELECT l.licensename,
l.licensetype,
count(DISTINCT l.userid) AS totalusers,
sum(
CASE
WHEN (l.licenseactive = true) THEN 1
ELSE 0
END) AS activelicenses,
sum(
CASE
WHEN (l.licenseactive = false) THEN 1
ELSE 0
END) AS inactivelicenses,
sum(
CASE
WHEN (l.copilotlicense = true) THEN 1
ELSE 0
END) AS copilotlicenses,
min(l.licenseassignmentdate) AS earliestassignment,
max(l.licenseassignmentdate) AS latestassignment,
max(l.updated) AS lastupdated
FROM subuserlicensedata l
WHERE (l.licensename IS NOT NULL)
GROUP BY l.licensename, l.licensetype
)| Name | Type | Default | Nullable | Children | Parents | Comment |
|---|---|---|---|---|---|---|
| licensename | varchar(100) | true | License Name | |||
| licensetype | varchar(100) | true | ||||
| totalusers | bigint | true | Distinct users that held this license at any time in the history | |||
| activelicenses | bigint | true | Open intervals: users currently holding the license | |||
| inactivelicenses | bigint | true | Closed intervals in the history | |||
| copilotlicenses | bigint | true | Intervals, open or closed, of a Copilot license | |||
| earliestassignment | timestamp without time zone | true | ||||
| latestassignment | timestamp without time zone | true | ||||
| lastupdated | timestamp without time zone | true |
| Name | Columns | Comment | Type |
|---|---|---|---|
| public.subuserlicensedata | 13 | License assignment history from Genesys Cloud: one row per Assignment interval, open or closed. User attributes are copied from userdetails when a row is written. | BASE TABLE |