A Database Error Occurred

Error Number: 2013

Lost connection to MySQL server during query

select m.*, mc.title mc_title, mt.single_url, mt.multiple_url, mt.single_ru single, mt.multiple_ru multiple, d.status d_status, d.id d_id, group_concat(distinct t.tag, '|', t.id) t_tags, ifnull(avg(rv.rate),0) rating, count(distinct rv.user_id) rating_votes_cnt, group_concat(distinct '{"id":"', mc.id, '","title":"', mc.title, '","type":"', mc.type, '","mc.pos":"', mc.pos, '","alias":"', mc.alias, '"}') mc_cats, group_concat(distinct b.id) b_ids, u.name u_name, u.alias u_alias , 1 is_rated from base_mat m left join base_user u on u.id=m.author_id left join base_rating_vote rv on rv.entity_id=m.id and rv.entity='mat' left join base_mat_type mt on m.mat_type is not null and mt.alias = m.mat_type left join base_tag_entity te on te.entity='mat' and te.entity_id=m.id left join base_tag_entity te2 on te2.entity='mat' and te2.entity_id=m.id left join base_tag t on t.id=te.tag_id left join base_mat_mat_cat mmc on mmc.mat_id=m.id left join base_mat_cat mc on mc.id=mmc.mat_cat_id left join base_mat_mat_cat mmc2 on mmc2.mat_id=m.id left join base_mat_cat mc2 on mc2.id=mmc2.mat_cat_id left join base_blog b on b.mat_id=m.id left join base_delivery d on d.entity='mat' and d.entity_id=m.id where 1 and m.alias='zapiska-an-shelepina-ns' and m.mat_type='doc' and m.status='active' group by m.id order by if(m.status='active',1,0) desc limit 1