Código PHP:
$sql="SELECT * FROM Unidades";
$respuesta=mysql_query($sql) or die(mysql_error());
while($datos=mysql_fetch_array($respuesta))
{
echo $datos['unidad'];
$sql2="SELECT * FROM Temas WHERE id_unidad=".$datos['id_unidad'];
$respuesta2=mysql_query($sql2) or die(mysql_error());
while($datos2=mysql_fetch_array($respuesta2))
{
echo $datos2['tema'];
}
}
creo que esto te puede solucionar el problema