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

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?

Leave a Reply

Your email address will not be published. Required fields are marked *