Definition
Information
Section titled “Information”The Admin Team model holds team definitions, including their names, descriptions and organisation and folder identifiers. It records active, virtual and deleted flags, alongside settings for accepting cross-organisation tasks and viewing patients under nineteen or aged nineteen and over.
Soft-Deleted Records
Section titled “Soft-Deleted Records”_deleted indicates whether the record has been deleted in the source system.
Examples
Section titled “Examples”admin.team with dbo.organisation and dbo.teamfolder details
Section titled “admin.team with dbo.organisation and dbo.teamfolder details”Return records alongside descriptive values from the related tables.
SELECT m."teamid", m."organisationid", p1."organisationdisplayname" AS "organisationdisplayname", m."teamfolderid", p2."foldername" AS "teamfolder_foldername"FROM admin.team AS mLEFT JOIN dbo.organisation AS p1 ON p1."organisationid" = m."organisationid" AND p1."organisation" = m."organisation"LEFT JOIN dbo.teamfolder AS p2 ON p2."teamfolderid" = m."teamfolderid" AND p2."organisation" = m."organisation";admin.teamuserinrole count per admin.team
Section titled “admin.teamuserinrole count per admin.team”Count related admin.teamuserinrole records for each admin.team record, joined on teamid.
SELECT m."teamid", m."description", COUNT(c."teamid") AS teamuserinrole_countFROM admin.team AS mLEFT JOIN admin.teamuserinrole AS c ON m."teamid" = c."teamid" AND m."organisation" = c."organisation"GROUP BY m."teamid", m."description"ORDER BY teamuserinrole_count DESC;Row count by dbo.organisation organisationdisplayname
Section titled “Row count by dbo.organisation organisationdisplayname”Count admin.team records for each dbo.organisation value, joined on organisationid.
SELECT p."organisationdisplayname" AS "organisationdisplayname", COUNT(*) AS row_countFROM admin.team AS mINNER JOIN dbo.organisation AS p ON p."organisationid" = m."organisationid" AND p."organisation" = m."organisation"GROUP BY p."organisationdisplayname"ORDER BY row_count DESC;