Skip to content

Instantly share code, notes, and snippets.

@hopeseekr
Created December 14, 2024 12:03
Show Gist options
  • Save hopeseekr/60af54a52c6995689fed43c575851f29 to your computer and use it in GitHub Desktop.
Save hopeseekr/60af54a52c6995689fed43c575851f29 to your computer and use it in GitHub Desktop.
-- Combine these two queries into a table.
SELECT
sub.min_version AS version,
COUNT(*) AS count
FROM (
SELECT
package,
min(version) AS min_version
FROM
supported_php_versions
GROUP BY
package
) AS sub
WHERE
sub.min_version IN ('5.0', '5.1', '5.2', '5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3')
GROUP BY
sub.min_version
ORDER BY
sub.min_version;
SELECT
sub.max_version AS version,
COUNT(*) AS count
FROM (
SELECT
package,
MAX(version) AS max_version
FROM
supported_php_versions
GROUP BY
package
) AS sub
WHERE
sub.max_version IN ('5.0', '5.1', '5.2', '5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3')
GROUP BY
sub.max_version
ORDER BY
sub.max_version;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment