I have a table \"Item\" with a number of related items, like so:
ID Rel_ID Name RelRank --- ------ ---- ------- 1 1 foo 1 2 1 bar
I think you are looking for a mysql specific answer. Keep in mind that the syntax could vary across different data stores.
MySQL has a feature that makes this easy.
SELECT Rel_ID, GROUP_CONCAT(Name SEPARATOR ' ') As Names FROM Item GROUP BY Rel_ID;
that should work :-)