select count(r.frep_key) from t_frm_rep r
left join t_logins l on l.logins_key = r.fk_logins
left join t_rank rk on rk.rank_key = l.fk_rank
left join t_frm_top t on t.ftop_key = r.fk_frm_top
left join t_frm f on f.frm_key = t.fk_frm
left join t_frm_watchlist w on w.fk_frm_top = t.ftop_key
left join t_frm_opt o on o.fk_logins = l.logins_key
where t.ftop_hide = 'no' and t.ftop_active = '1' and r.frep_active = '1' and l.logins_username = 'Blackbird' and f.frm_active = '1' order by r.frep_date
Got error 12 from storage engine