Optimering af SQL-sætning
Har lige en SQL-sætning som jeg ville høre om nogen havde forslag til hvordan jeg kunne performance-optimere (Helst lidt hurtigt)???SELECT count(MSG_ID) AS NO_TOPIC,
(SELECT COUNT (REP_ID) FROM [dbo].REPLIES WHERE REPLIES.FOR_ID = @iForumID) AS NO_POST,
(SELECT MAX (MSG_DATETIME) FROM [dbo].MESSAGES WHERE MESSAGES.FOR_ID = @iForumID) AS LAST_MSG_DATE,
(SELECT MAX (REP_DATETIME) FROM [dbo].REPLIES WHERE REPLIES.FOR_ID = @iForumID) AS LAST_POST
FROM [dbo].MESSAGES
WHERE MESSAGES.FOR_ID = @iForumID
GROUP BY MESSAGES.FOR_ID