При использовании SQL Server 2005+, Oracle 8i +, PostgreSQL 8.4 + - вы можете использовать аналитические функции:
SELECT x.col1, x.col2,
MAX(CASE WHEN x.rk = 1 THEN x.col3 END) AS Res1,
MAX(CASE WHEN x.rk = 2 THEN x.col3 END) AS Res2,
MAX(CASE WHEN x.rk = 3 THEN x.col3 END) AS Res3
FROM (SELECT yt.col1,
yt.col2,
yt.col3,
ROW_NUMBER() OVER(PARTITION BY yt.col1, yt.col2
ORDER BY yt.col3) AS rk
FROM YOUR_TABLE yt) x
GROUP BY x.col1, x.col2