时间:2021-07-01 10:21:17 帮助过:15人阅读
连接数据库就不写了,按照表格输出也很简单。
$query="select xmpf_xm,sum(xmpf_small_zf) zf,avg(xmpf_small_zf) avg from tb_xmpf group by xmpf_xm";//查总分平均分
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
$sql = "insert into tb_xm (xmpf_xm,xm_zf,xm_avg) values($row['xmpf_xm'],$row['zf'],$row['avg'])";//插入总分平均分
mysql_query($sql);
}