mysql statement with inner SELECT - how to improve performance
- by ernie
This statement appears inefficient because only one one out of 10 records are selected and only a of 100 entries contain comments.
What can I do to improve it ?
$query = "SELECT
A,B,C,
(SELECT COUNT(*)
FROM comments
WHERE comments.nid = header_file.nid)
as my_comment_count
FROM header_file
Where A = 'admin' "