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 求指导ADS低噪放设计
  • ¥15 CARSIM前车变道设置
  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存