SELECT A.*,case A.cat_order when 0 then 999 else A.cat_order end as cat_orders,B.sCort, count(C.pro_id) as cat_pro_nums from bb_product_category A ,bb_product_category B left join bb_product C on C.cat_id = B.cat_id and C.pro_state=1 and C.pro_bbt_state <> 2 and C.pro_online_date<='2024-06-30 18:25:26' and C.pro_online_date!='0000-00-00 00:00:00' and C.user_id = '1090' and C.com_id = '1233' where A.user_id = '1090' and A.com_id = '1233' and substring(B.sCort,1,length(A.sCort))=A.sCort and A.cat_state = 1 and A.cat_parentid = 4931 and A.cat_bbt_state <> 2 group by A.cat_id order by A.cat_orderLost connection to MySQL server during query