SELECT SQL_CALC_FOUND_ROWS p.* FROM `fmn_posts` as p, `fmn_term_relationships` as tr LEFT JOIN `fmn_term_taxonomy` as tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE p.post_type = "my_portfolio" AND tr.object_id = p.ID AND tt.term_id IN (16) AND (p.post_status = "publish" OR p.post_status = "private") GROUP BY p.ID ORDER BY p.post_date DESC LIMIT 0, 50