Definition
Information
Section titled “Information”The Prescribing Localmixtureconstituent model records constituents of local medication mixtures, including coded item information, the original term and recorded strength. It also holds mixture and constituent identifiers, legacy coding information and a GUID, together with source organisation information.
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.localmixtureconstituent with prescribing.localmixture details
Section titled “prescribing.localmixtureconstituent with prescribing.localmixture details”Return records alongside descriptive values from the related prescribing.localmixture record.
SELECT m."localmixtureconstituentid", m."localmixtureid", p1."localmixturename" AS "localmixturename"FROM prescribing.localmixtureconstituent AS mLEFT JOIN prescribing.localmixture AS p1 ON p1."localmixtureid" = m."localmixtureid" AND p1."organisation" = m."organisation";Row count by prescribing.localmixture localmixturename
Section titled “Row count by prescribing.localmixture localmixturename”Count prescribing.localmixtureconstituent records for each prescribing.localmixture value, joined on localmixtureid.
SELECT p."localmixturename" AS "localmixturename", COUNT(*) AS row_countFROM prescribing.localmixtureconstituent AS mINNER JOIN prescribing.localmixture AS p ON p."localmixtureid" = m."localmixtureid" AND p."organisation" = m."organisation"GROUP BY p."localmixturename"ORDER BY row_count DESC;Records without a matching prescribing.localmixture
Section titled “Records without a matching prescribing.localmixture”Find prescribing.localmixtureconstituent records whose localmixtureid has no matching prescribing.localmixture record.
SELECT COUNT(*) AS unmatched_countFROM prescribing.localmixtureconstituent AS mLEFT JOIN prescribing.localmixture AS p ON p."localmixtureid" = m."localmixtureid" AND p."organisation" = m."organisation"WHERE m."localmixtureid" IS NOT NULL AND p."localmixtureid" IS NULL;