$sql="select * from sum_db order by id";
$result=mysql_query($sql);
while($row_sum=mysql_fetch_array())
{
$i++;
$id=$row_sum['id'];
$sql2="select sum(vote) from sum_db where id='$id'";
$result2=mysql_query($sql2);
$row_sum2=mysql_fetch_array();
ขอบคุณนะครับสพหรับคำตอบผมลองคำตอบที่3มาใช้แบบนี้
<?php
include "connect.php";
$sql="select * from tb_sumvote order by id";
$result=mysql_query($sql);
while($row_sum=mysql_fetch_array())
{
$i++;
$id=$row_sum['id'];
$sql2="select sum(vote) from tb_sumvote where id='$id'";
$result2=mysql_query($sql2);
$row_sum2=mysql_fetch_array();