php - MYsql query and DB help -
when trying execute query mysql server cpu usage goes 100% , page stalls. setup index on (client_code, date_time, time_stamp, activity_code, employee_name, id_transaction) doesn't seem help. steps can go next fix issue? there 1 index on database if matters any. thanks
> $sql = "select m.employee_name, count(m.id_transaction) >from ( select distinct client_code transaction) > md join transaction m on > m.id_transaction = ( select > id_transaction transaction mi > mi.client_code = md.client_code , date_time=curdate() , time_stamp!='' , > activity_code!='000001' > order m.employee_name desc, mi.client_code desc, mi.date_time desc, > mi.id_transaction desc limit 1 ) > group m.employee_name";
i've got feeling it's due > sign next and, expression you're trying make that?
Comments
Post a Comment