Linq to SQL With Left Outer Join and Group By With Sum - How To?

You use the .Sum() method Eg Public Sub LinqToSqlCount03() Dim q = (From o In db. Orders _ Select o. Freight).Sum() Console.

WriteLine(q) End Sub.

You use the .Sum() method. Eg; Public Sub LinqToSqlCount03() Dim q = (From o In db. Orders _ Select o.

Freight).Sum() Console. WriteLine(q) End Sub.

Pace, I know I have to use the .Sum() method. But how would I add that to the query that I showed? – João Guilherme Nov 6 '09 at 13:40.

According to MSDN there is no query expression equivalent to the Sum() operation. I provided a little sample how you could use the Method Syntax of Sum() in a query. Some query operations, such as Count or Max, have no equivalent query expression clause and must therefore be expressed as a method call.

Method syntax can be combined with query syntax in various ways. For more information, see LINQ Query Syntax versus Method Syntax (C#). Var example = new { new { Count = 1, Name = "a" }, new { Count = 2, Name = "b" }, new { Count = 2, Name = "c" }, new { Count = 2, Name = "c" } }; var result = from x in example select new { x.Name, Sum = (from y in example where y.Count.

Equals(2) && y. Name==x.Name select y. Count).Sum() }; var distinct = result.Distinct().ToList().

Left outer join Categorias on Lancamentos. IdCategoria = Categorias. And Lancamentos.

Group by Categorias. Where lancamento. && lancamento.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions