Board logo

標題: 請問如何對多筆資料加總後, 再利用其結果排序 [打印本頁]

作者: porkchop970    時間: 2011-1-25 15:33     標題: 請問如何對多筆資料加總後, 再利用其結果排序

$sql="SELECT * FROM newforum where type=121 and source=17 group by bc order by $noof asc";
$result=mysql_query($sql);
while (list($no,$date,$type,$title,$content,$ba,$bb,$bc,$bd,$be,$bf,$id,$mainname,$source,$position,$uploada,$uploadb,$uploadc,$updatetime,$hits,$postmemid,$posthktdname,$postidentity,$postclub)=mysql_fetch_row($result))
{
$rows=mysql_query("select * from newforum where type=121 and source=17 and bc=$bc");$noof=mysql_num_rows($rows);
echo $bc."-".$noof."<br>";
}




歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)