Why they use LEFT JOIN and chose meta table as outer table in this query ? Isn’t it ineffective to do that way ?

SELECT meta.meta_value, COUNT( * ) as meta_value_count
FROM $wpdb->commentmeta AS meta
LEFT JOIN $wpdb->comments AS comm ON meta.comment_id = comm.comment_ID
WHERE meta.meta_key = 'rating'
AND comm.comment_post_ID = %d
AND comm.comment_approved = '1'
AND meta.meta_value > 0
GROUP BY meta.meta_value

Read more here: Why they use LEFT JOIN and chose meta table as outer table in this query ? Isn’t it ineffective to do that way?


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: