This is my MS SQL Query ( I m using this as a Stored Procedure ). I am new to LINQ. I am using .NET framework 4.0 and Entity Framework.
Query 1
SELECT SUM(PTS.Run1)AS Run1,SUM(PTS.Run2)AS Run2,
SUM(PTS.Run3)AS Run3,SUM(PTS.Run4)AS Run4,SUM(PTS.Run6)AS Run6
,SUM(PTS.BallsFaced)AS BallsFaced
FROM PlayerTeamSeason PTS
INNER JOIN Player P ON P.ID=PTS.PlayerId
WHERE P.CrewId =89 and PTS.SeasonId=1
EDIT 1
I need solution for getting
- MAX value and JOIN(kindly refer Query 1)
EDIT 2
from crew in Oritia_entities.Crews
join P in Oritia_entities.Players on crew.ID equals P.CrewId
//select new { P.ID, P.Matches };
join PTS in Oritia_entities.PlayerTeamSeasons on P.ID equals PTS.PlayerId
select new
{
TotalRuns = PTS.Run1 + PTS.Run2 + PTS.Run3 + PTS.Run4 + PTS.Run6
,
Bowls = PTS.BallsFaced
};
I had re write the query to LINQ. But how can I use SUM here. As I write in my sql query
Thanks
VeeKeyBee
Article on MSDN for SP that returns multiple result sets. Google first.
LINQ to SQL: returning multiple result sets