Hacker News new | ask | show | jobs
by vlasky 1247 days ago
This also works in MySQL 8.0.19 and above but the syntax of the CTE example needs to be tweaked to use the ROW() constructor:

    WITH countries (code, name) AS (
        SELECT * FROM (VALUES 
            ROW('us', 'United States'),
            ROW('fr', 'France'),
            ROW('in', 'India')
        ) AS codes
    )
    SELECT data.code, name FROM data LEFT JOIN countries.code = data.code;