SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (1) ) AND ( ( wp_postmeta.meta_key = 'Proiezione' AND CAST(wp_postmeta.meta_value AS DATE) > '2018/07/16' ) OR ( wp_postmeta.meta_key = 'mostra_senza_data' AND CAST(wp_postmeta.meta_value AS CHAR) = '1' ) ) AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish') GROUP BY wp_posts.ID ORDER BY wp_posts.post_date ASC LIMIT 0, 3<--