I not infrequently need to convert column data into row data - typically when data is stored in tagged fashion. This is accomplished by inner-joins on the same table, but with different alias' and constraints on each one.
SELECT A.name, A,age, B.name, B.age, C.name, C.age
FROM YOUR_TABLE as A
INNER JOIN YOUR_TABLE as B
ON A.something=b.something
INNER JOIN YOUR_TABLE C
ON B.something=c.something
WHERE A.whatever=value
AND B.whatever=value
AND C.whatever=value
etc. etc. etc.
You'll need to determine how to link these.