qq_1020788318 2022-03-09 21:50 采纳率: 100%
浏览 33
已结题

商品省份归属统计,36行代码运行太慢,如何简化提速?

商品归属省份统计,下面代码优化
  • $arrCountP1= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =1  " );
    $arrCountP2= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =2  " );
    $arrCountP3= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =3  " );
    $arrCountP4= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =4  " );
    $arrCountP5= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =5  " );
    $arrCountP6= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =6  " );
    $arrCountP7= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =7  " );
    $arrCountP8= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =8  " );
    $arrCountP9= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =9  " );
    $arrCountP10= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =10  " );
    $arrCountP11= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =11  " );
    $arrCountP12= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =12  " );
    $arrCountP13= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =13  " );
    $arrCountP14= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =14  " );
    $arrCountP15= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =15  " );
    $arrCountP16= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =16  " );
    $arrCountP17= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =17  " );
    $arrCountP18= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =18  " );
    $arrCountP19= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =19  " );
    $arrCountP20= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =20  " );
    $arrCountP21= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =21  " );
    $arrCountP22= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =22  " );
    $arrCountP23= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =23  " );
    $arrCountP24= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =24  " );
    $arrCountP25= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =25  " );
    $arrCountP26= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =26  " );
    $arrCountP27= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =27  " );
    $arrCountP28= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =28  " );
    $arrCountP29= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =29  " );
    $arrCountP30= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =30  " );
    $arrCountP31= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =31  " );
    $arrCountP32= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =32  " );
    $arrCountP33= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =33  " );
    $arrCountP34= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =34  " );
    $arrCountP35= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =35  " );
    $arrCountP36= db_factory::get_count ( "select count(*) from " . TABLEPRE . "service where cat = '$ky' and province =36  " );
    
  • 写回答

1条回答 默认 最新

报告相同问题?

问题事件

  • 系统已结题 3月18日
  • 已采纳回答 3月10日
  • 修改了问题 3月9日
  • 创建了问题 3月9日

悬赏问题

  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)