WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INNER JOIN wp_term_relationships as tr1 ON (wp_posts.ID = tr1.object_id) WHE' at line 3]
SELECT wp_posts.* FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) WHERE 1=1 AND ( wp_postmeta.meta_key = '_views' INNER JOIN wp_term_relationships as tr1 ON (wp_posts.ID = tr1.object_id) WHERE tr1.term_taxonomy_id IN (21,22) AND (wp_posts.post_type = 'resource' OR wp_posts.post_type = 'library-collection') AND (wp_posts.post_status = 'publish') GROUP BY wp_posts.ID ORDER BY wp_postmeta.meta_value+0 ASC