1.
SELECT a.* FROM app a WHERE a.app_version = (SELECT MAX(b.app_version) FROM app b WHERE b.app_name = a.app_name) ORDER BY a.app_name;
2.
SELECT a.* FROM app a WHERE NOT EXISTS(SELECT 1 FROM app b WHERE b.app_name = a.app_name AND b.app_version > a.app_version) ORDER BY a.app_name;
3.
SELECT a.* FROM app a, (SELECT app_name, MAX(app_version) AS app_version FROM app GROUP BY app_name) b WHERE a.app_name = b.app_name AND a.app_version = b.app_version ORDER BY a.app_name;
4.
SELECT a.* FROM app a INNER JOIN (SELECT app_name, MAX(app_version) AS app_version FROM app GROUP BY app_name) b ON a.app_name = b.app_name AND a.app_version = b.app_version ORDER BY a.app_name;
时间: 2024-11-02 21:38:20