Invalid query:
Whole query: SELECT * FROM
(
SELECT
e.entry_id AS id,
e.entry_blog_id AS blogId,
em3.entry_meta_vchar_idx AS categoryName,
em2.entry_meta_vchar_idx AS reviewId,
e.entry_title AS title,
e.entry_excerpt AS excerpt,
IF (em2.entry_meta_vchar_idx != '', em2.entry_meta_vchar_idx, e.entry_id) AS rating_id,
IF(COUNT(1) < 20,0,(SUM(v.ajaxrating_vote_score) / COUNT(1))) AS rating,
COUNT(1) as v_count,
em4.entry_meta_vchar_idx AS iconBasename,
fi.fileinfo_url AS url,
fi2.fileinfo_url AS urlEntry,
e.entry_authored_on AS authoredOn,
e.entry_keywords AS featured,
IF (w.walkthrough_id IS NULL, 0, 1) AS hasWalkthrough
FROM mt_entry AS e
JOIN mt_entry_meta AS em1
ON e.entry_id = em1.entry_meta_entry_id
JOIN mt_entry_meta AS em2
ON e.entry_id = em2.entry_meta_entry_id
LEFT JOIN walkthroughs AS w
ON em2.entry_meta_vchar_idx = w.entry_id
LEFT JOIN mt_ajaxrating_vote AS v
ON IF (em2.entry_meta_vchar_idx != '', em2.entry_meta_vchar_idx, e.entry_id) = v.ajaxrating_vote_obj_id
JOIN mt_entry_meta AS em3
ON e.entry_id = em3.entry_meta_entry_id
JOIN mt_entry_meta AS em4
ON e.entry_id = em4.entry_meta_entry_id
LEFT JOIN mt_fileinfo AS fi
ON (e.entry_id = fi.fileinfo_entry_id) AND (e.entry_blog_id = fi.fileinfo_blog_id)
LEFT JOIN mt_fileinfo AS fi2
ON (em2.entry_meta_vchar_idx = fi2.fileinfo_entry_id)
WHERE
e.entry_class = 'page'
AND e.entry_blog_id = 1
AND e.entry_status = 2
AND fi.fileinfo_templatemap_id = 28
AND em1.entry_meta_type = 'field.game_filename'
AND em1.entry_meta_vchar_idx != ''
AND em2.entry_meta_type = 'field.review_entry_id'
AND em3.entry_meta_type = 'field.game_category'
AND em4.entry_meta_type = 'field.icon_basename'
AND e.entry_authored_on <= DATE_ADD(NOW(), INTERVAL 3 HOUR)
GROUP BY e.entry_id
ORDER BY e.entry_authored_on ASC
) AS temp
GROUP BY rating_id
ORDER BY featured DESC, authoredOn DESC
LIMIT 9 OFFSET 0
Recent Comments