It works, easily extends and does not depend on any values โโthat are not found in the data, but are probably extremely inefficient!
CREATE TABLE X ( Id int primary key, col1 int null, col2 int null, col3 int null )
Request
SELECT id, Min(CASE c WHEN 1 THEN col1 WHEN 2 THEN col2 WHEN 3 THEN col3 END) FROM x, (SELECT 1 AS c UNION ALL SELECT 2 UNION ALL SELECT 3) t GROUP BY id
source share