Upcoming Anime

This “Upcoming” template have a custom query ordered by the movies/series with release date after the present day (constantly checks if is today).

WordPress database error: [Unknown column 'post_views' in 'having clause']
SELECT DISTINCT wp9l_posts.ID FROM wp9l_posts INNER JOIN wp9l_postmeta ON ( wp9l_posts.ID = wp9l_postmeta.post_id ) LEFT JOIN wp9l_post_views pvc ON pvc.id = wp9l_posts.ID AND pvc.type = 4 WHERE 1=1 AND ( ( wp9l_postmeta.meta_key = 'anilist_release_date' AND CAST(wp9l_postmeta.meta_value AS DATE) > '2026-06-18' ) OR ( wp9l_postmeta.meta_key = 'theatrical_release' AND CAST(wp9l_postmeta.meta_value AS DATE) > '2026-06-18' ) OR ( wp9l_postmeta.meta_key = 'aired_init' AND CAST(wp9l_postmeta.meta_value AS DATE) > '2026-06-18' ) ) AND ((wp9l_posts.post_type = 'movies' AND (wp9l_posts.post_status = 'publish' OR wp9l_posts.post_status = 'acf-disabled')) OR (wp9l_posts.post_type = 'series' AND (wp9l_posts.post_status = 'publish' OR wp9l_posts.post_status = 'acf-disabled'))) GROUP BY wp9l_posts.ID, wp9l_postmeta.meta_id HAVING post_views > 0 ORDER BY post_views DESC, CAST(wp9l_postmeta.meta_value AS DATE) DESC