I want to know which of the 2 queries below is faster :-
Select s.*,
sm.*
from tblStudent s
Inner Join (SELECT studentId,SUM(marks) As Sum
from tblStudentsMarks
Group By studentId) as sm on s.StudentID = sm.StudentID;
...or:
Select s.studentId,
s.Name,
SUM(Marks)
From tblStudent s
Inner Join tblStudentsMarks sm On s.Studentid = sm.StudentId
Group By s.studentId, s.Name;
EDIT :-
Query Estimation of 1st Query :- http://img28.imageshack.us/img28/166/1stpicd.jpg
Query Estimation of 2nd Query :- http://img245.imageshack.us/img245/5064/2ndpic.jpg
Thanks in advance :)