sfmc // SQLPRODUCTION

Latest Version per Journey

Return only the highest version number for each JourneyID and optionally exclude inactive states.

sqljourneyversionjourney builder
Context Pack →Open Workspace →
Trust & provenancePRODUCTION
Evidence tierPRODUCTIONOfficial sources0Other sources0Last verifiedNot recorded

Evidence tier describes my hands-on relationship with the content. Official sources describe platform contracts/documentation. Production observations should not automatically be treated as official limits.

SELECT
    j.JourneyID,
    j.VersionID,
    j.JourneyName,
    j.VersionNumber,
    j.JourneyStatus,
    j.ModifiedDate
FROM _Journey j
INNER JOIN (
    SELECT JourneyID, MAX(VersionNumber) AS MaxVersion
    FROM _Journey
    GROUP BY JourneyID
) latest
    ON latest.JourneyID = j.JourneyID
    AND latest.MaxVersion = j.VersionNumber
WHERE j.JourneyStatus NOT IN ('Stopped', 'Draft')
Operational notes

JourneyID groups versions; VersionID identifies a specific version.

Decide whether Finishing should be included based on the reporting purpose.

Related