时间:2021-07-01 10:21:17 帮助过:21人阅读
$xmpc_id='4';/******************************************/$query1=mssql_query("select * from tb_xm where xm_pcid='$xmpc_id'"); while($myrow1=mssql_fetch_assoc($query1)){ echo $myrow1[xm_name]; $xm_name = $myrow1['xm_name']; $query2=mssql_query("select sum(xmpf_small_zf) as zf from tb_xmpf where xmpf_xm='$myrow1[xm_name]'"); //echo $query2; echo "总分:"; while($myrow2=mssql_fetch_assoc($query2)){ echo $myrow2[zf]; $query3=mssql_query("update tb_xm set xm_zf='$myrow2[zf]' where xm_name='$myrow1[xm_name]'"); }
条件不充分
select * from tb_xm where xm_pcid='$xmpc_id'
按批次取得项目名称,可知批次和项目名称并非一一对应的
可知一个项目名称可分属于不同的批次
select sum(xmpf_small_zf) as zf from tb_xmpf where xmpf_xm='$myrow1[xm_name]'
按项目名称取得得分
但是没有考虑到批次因素
mysql_fetch_assoc