Skip to content

Instantly share code, notes, and snippets.

@patrickbkr
Created June 1, 2021 13:56
Show Gist options
  • Save patrickbkr/0822bb608f383e903897b4ea1ef7ccab to your computer and use it in GitHub Desktop.
Save patrickbkr/0822bb608f383e903897b4ea1ef7ccab to your computer and use it in GitHub Desktop.
"SELECT mv.* FROM ModuleVersion mv INNER JOIN
(
SELECT majorversion AS majver, minorversion AS minver
FROM ModuleVersion inner_mv
JOIN Module inner_m
ON inner_mv.moduleId = inner_m.id
AND inner_m.name = :module
WHERE inner_mv." + $calcType.getDBColumnName() + " = 1
ORDER BY majorversion DESC, minorversion DESC
LIMIT 1
) other
ON mv.majorversion = other.majver AND mv.minorversion = other.minver
JOIN Module m
ON mv.moduleId = m.id
AND m.name = :module"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment