SELECT n.*, (SELECT COUNT(*) FROM comments c WHERE c.c_id = n.id && c.c_type_id = 'MAX_SALON_DATA_IN_PROFILE') as num_comments FROM news n WHERE n.u_id = '51' && n.active = 1 ORDER BY n.published DESC, n.id DESC . Table 'allabspa2.news' doesn't exist