my query getting o/p like this
partyname bjp aap congress
votes 1 2 2
but i also need sum of row. below is my expected output.
all the partyname and votes comes from database and it is dynamic.
for ex
BJP aap congress total
1 2 2 5
<?php
$sqltoatl = "SELECT RES.PARTYNAME, COUNT( RES.CONSTITUENCY )
AS VOTESCOUNT FROM voter_count RES JOIN (SELECT CONSTITUENCY, MAX( VOTES )
AS VOTES FROM voter_count GROUP BY CONSTITUENCY)MAXS USING ( VOTES, CONSTITUENCY )
GROUP BY PARTYNAME LIMIT 0 , 1000";
$resulttoatl = mysql_query($sqltoatl);
while ($rowtoatl = mysql_fetch_array($resulttoatl,MYSQL_ASSOC)) {
?>
<th><?php echo $rowtoatl['PARTYNAME']; ?></th>
<td><?php echo $rowtoatl['VOTESCOUNT']; ?></td>
<?php } ?>