puede q te ayude esto:
Código PHP:
<?php
mysql_connect("localhost","root","");
mysql_select_db("nombre_bd");
$bus=mysql_query("select partner_id, name from partners where is_mov=1 order by partner_id");
while($con=mysql_fetch_array($bus)){
$partner = $con['partner_id'];
$partner_name = $con['name'];
$rr=mysql_query("select top 1 reference from services where fk_partner_id = '$partner' order by service_id desc");
if($conrr=mysql_fetch_array($rr)){
$service_reference=$conrr['reference'];
?>
<td><div align="left"><?php echo $partner;?></td>
<td><div align="left"><?php echo $partner_name;?></td>
<td><div align="left"><?php echo $ervice_reference;?></td>
</tr>
<?php
}
}
?>
</table>
</div>
<?php
mysql_close();
?>