Join and sort. Display is where it can get tricky since you don't really describe what you want the output to look like.
PHP Code:
$sql = "SELECT t1.their_name, t2.heading, t2.group_id FROM table1 t1 INNER JOIN table2 t2 ON t2.group_id = t1.group_id ORDER BY t2.group_id ASC";
if ($qry = mysql_query($sql))
{
$iLastGroup = 0;
while($row = mysql_fetch_assoc($qry))
{
if ($iLastGroup != $row['group_id'])
{
if ($iLastGroup > 0)
{
print('</ul>');
}
printf('<h3>%s</h3>', $row['heading']);
print('<ul>');
$iLastGroup = $row['group_id'];
}
printf('<li>%s</li>', $row['their_name']);
}
print('</ul>');
}
Would give you a header and an unordered list. Untested, but looks to work.