1个回答
展开全部
$res_type = mysqli_query($link, "select 防患级别 from table1 group by 防患级别");
while ($arr_type = mysqli_fetch_array($res_type)){
$type = $arr_type[0];
$sum_wait = mysqli_num_rows(mysqli_query($link, "select * from table1 where 防患类别='{$type}' and 状态='代办'"));
$sum_done = mysqli_num_rows(mysqli_query($link, "select * from table1 where 防患类别='{$type}' and 状态='已解决"));
$sum_total = mysqli_num_rows(mysqli_query($link, "select * from table1 where 防患类别='{$type}' "));
mysqli_query($link, "insert into table2 values('{$type}','{$sum_wait}','{$sum_done}','{$sum_total}')")
}
while ($arr_type = mysqli_fetch_array($res_type)){
$type = $arr_type[0];
$sum_wait = mysqli_num_rows(mysqli_query($link, "select * from table1 where 防患类别='{$type}' and 状态='代办'"));
$sum_done = mysqli_num_rows(mysqli_query($link, "select * from table1 where 防患类别='{$type}' and 状态='已解决"));
$sum_total = mysqli_num_rows(mysqli_query($link, "select * from table1 where 防患类别='{$type}' "));
mysqli_query($link, "insert into table2 values('{$type}','{$sum_wait}','{$sum_done}','{$sum_total}')")
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询