I'm running a simple query to show forum posts. I've expanded my basic query to show a count of all the replies for each forum post:
TOP 50 f.postDate AS datePosted,
f.postTitle AS title,
(SELECT COUNT(*) FROM tbl_forums WHERE postParentID = f.ID) as replies
tbl_Forums f INNER JOIN
tbl_Users u ON f.userID = u.userID
This seems rather inefficient from a resource perspective because it reads as though the count takes place for every row. Maybe I'm wrong, but is there a better way to construct this query??