Definition
Information
Section titled “Information”The Prescribing Localmixture model holds named local medication mixtures and their recorded identifiers. It also stores creation and editing dates and times, identifiers for the creating and editing users in their roles, and organisation details describing the mixture record’s context.
Soft-Deleted Records
Section titled “Soft-Deleted Records”_deleted indicates whether the record has been deleted in the source system.
Examples
Section titled “Examples”prescribing.localmixture with dbo.organisation details
Section titled “prescribing.localmixture with dbo.organisation details”Return records alongside descriptive values from the related dbo.organisation record.
SELECT m."localmixtureid", m."organisationid", p1."organisationdisplayname" AS "organisationdisplayname"FROM prescribing.localmixture AS mLEFT JOIN dbo.organisation AS p1 ON p1."organisationid" = m."organisationid" AND p1."organisation" = m."organisation";prescribing.drugrecord count per prescribing.localmixture
Section titled “prescribing.drugrecord count per prescribing.localmixture”Count related prescribing.drugrecord records for each prescribing.localmixture record, joined on localmixtureid.
SELECT m."localmixtureid", m."localmixturename", COUNT(c."localmixtureid") AS drugrecord_countFROM prescribing.localmixture AS mLEFT JOIN prescribing.drugrecord AS c ON m."localmixtureid" = c."localmixtureid" AND m."organisation" = c."organisation"GROUP BY m."localmixtureid", m."localmixturename"ORDER BY drugrecord_count DESC;Row count by dbo.organisation organisationdisplayname
Section titled “Row count by dbo.organisation organisationdisplayname”Count prescribing.localmixture records for each dbo.organisation value, joined on organisationid.
SELECT p."organisationdisplayname" AS "organisationdisplayname", COUNT(*) AS row_countFROM prescribing.localmixture 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;