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 'ASC,
CASE object_type
WHEN 'movie' THEN 1
' at line 45]
(
SELECT
p.ID,
p.post_title,
m.poster_path,
m.imdb_rating,
'movie' AS object_type,
l.rank
FROM wp_tmdb_endpoint_lists l
INNER JOIN wp_movies m
ON m.tmdb_id = l.tmdb_id
INNER JOIN wp_posts p
ON p.ID = m.post_id
WHERE l.endpoint = 'trending_day'
AND l.object_type = 'movie'
AND l.missing = 0
AND p.post_type = 'movies'
AND p.post_status = 'publish'
AND m.release_date >= '2025-12-09'
)
UNION ALL
(
SELECT
p.ID,
p.post_title,
s.poster_path,
s.imdb_rating,
'tv' AS object_type,
l.rank
FROM wp_tmdb_endpoint_lists l
INNER JOIN wp_shows s
ON s.tmdb_id = l.tmdb_id
INNER JOIN wp_posts p
ON p.ID = s.post_id
WHERE l.endpoint = 'trending_day'
AND l.object_type = 'tv'
AND l.missing = 0
AND p.post_type = 'shows'
AND p.post_status = 'publish'
)
ORDER BY
rank ASC,
CASE object_type
WHEN 'movie' THEN 1
WHEN 'tv' THEN 2
END
LIMIT 20