Reputation: 176
PFB my query plan
My Query output
I need to get all the team members details based on all the Assigned/Active rounds
I want to optimize my query. PFB my query.
SELECT Ass.strassociatename,
Ass.strphotolink,
team.strteamname,
team.strteamlogo,
edu.streducationalinstitute,
rounds.strroundname
FROM ccs_vas_tbl_associates Ass,
ccs_vas_tbl_teams team,
ccs_vas_tbl_educationalinstitutes edu,
ccs_vas_tbl_rounds rounds,
ccs_vas_tbl_roundassignment roundass
WHERE team.iteamid = 64
AND ass.iteamid = team.iteamid
AND team.ieducationalinstituteid = edu.iinstituteid
AND Ass.icompetitionid = rounds.icompetitionid
AND roundass.strroundstatus = 'Assigned'
AND roundass.iroundid = rounds.iroundid
AND roundass.iteamid = team.iteamid
Upvotes: 1
Views: 180
Reputation: 1562
You may also try UPDATE STATISTICS
http://msdn.microsoft.com/en-AU/library/ms187348.aspx
Upvotes: 1
Reputation: 28403
May try this
SELECT Ass.strassociatename,
Ass.strphotolink,
team.strteamname,
team.strteamlogo,
edu.streducationalinstitute,
rounds.strroundname
FROM ccs_vas_tbl_associates Ass
JOIN ccs_vas_tbl_teams team ON ass.iteamid = team.iteamid
JOIN ccs_vas_tbl_educationalinstitutes edu ON team.ieducationalinstituteid = edu.iinstituteid
JOIN ccs_vas_tbl_rounds rounds ON Ass.icompetitionid = rounds.icompetitionid
JOIN ccs_vas_tbl_roundassignment roundass ON roundass.iroundid = rounds.iroundid AND roundass.iteamid = team.iteamid
WHERE team.iteamid = 64 AND roundass.strroundstatus = 'Assigned'
Upvotes: 1