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

Why they used 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 meta
LEFT JOIN $wpdb->comments 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 used 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 *