score:0
Accepted answer
var a = 123;
var sum = (from p in a where p.id == a) //gives 10 records.
.sum(x => int.parse(x.balance));
var sum = (from p in db.table where p.id == a)
.asenumerable() // @juharr's suggestion
.sum(x => convert.toint32(x.balance));
score:0
var sum = (from p in db.table where p.id == a)
.tolist()
.sum(x => convert.toint32(x.balance));
Source: stackoverflow.com
Related Query
- Not able to retrieve sum of varchar column using LINQ in c#
- How to retrieve column names which are byte and not null in C# json web service using LINQ class?
- How to retrieve indentity column vaule after insert using LINQ
- Sum of a particular column using LINQ
- In a table a column datatype is varchar, retrieve only those values of the column which are number / numeric using linq to sql
- sum of one column with condition using linq
- How do I check if a SQL Server 2005 TEXT column is not null or empty using LINQ To Entities?
- Not able to select values from right list using LINQ join
- asp.net c# Linq query to retrieve the sum of each value of a column
- Find All Rows in DataTable Where Column Value is NOT Unique Using Linq Query
- How to sum the values of a specific column attribute of individual rows returned using a LINQ expression? (C#)
- LINQ: join multiple Table Column using Linq and find aggregated sum from child table values
- select more column not in group by using linq in c#
- Not able to see relational table while querying in linq using EF
- How to query a date range from a varchar column using LINQ
- How to retrieve multiple column values with same foreign key id using Linq method Syntax in C#?
- How to calculate sum on a datable column using linq with a where clause?
- GROUP BY in datatable on two columns with sum of third column using LINQ
- using LINQ query to get max of a varchar column
- Get Group sum not using group.Sum() in linq
- How sum a column in Entity Framework using linq and join it with another table
- sum two column using linq
- Not able to compare two Lists using LINQ
- returning multiple column and sum using linq expression
- How to retrieve a List of Lists of strings that are not null or whitespace from a DataGridView using Linq
- Not able to access a element using LINQ and XDocument
- Error [ORA-00979: not a GROUP BY expression] when using sum in simple linq
- How to search a text contains or not in particular column that contain Json object using linq
- datatable sum column and concatenate rows using LINQ and group by on multiple columns
- Excel Import : Data not being read if column has different data formats in MVC C# using linq
More Query from same tag
- How to write a Lambda Expression to select distinct words from list of sentences
- Shadow Properties to access related entity with Table-Per-Hierarchy inheritance model
- Extension method returning lambda expression through compare
- Trying to parse XML tree with Linq to XML (C#)
- How to replace ToList() with Join()
- Group by year and month the get value
- How can I get LINQ to return the object which has the max value for a given property?
- Linq - Grouping where items fall in multiple groups?
- How to cast a generic T in repository<T> to an interface to access an interface property conditionally in a LINQ to SQL filter?
- How to Replace CSV String in LINQ Query , Wanted to Replace CSV with NewLine in LINQ
- Relational division in LINQ?
- LINQ .Contains on list
- C# Generic XML reader code
- What is the best way to transparently log changes to objects when using LINQ-to-SQL?
- Method cannot be translated into a store expression in LINQ
- Linq with a Dictionary inside the class
- Is there a way of splitting a C# generic dictionary into multiple dictionaries?
- Only primitive types or enumeration types are supported in this context in linq
- Using LINQ for Group and Sum
- LINQ to determine if children exist
- How can I recursively iterate a date's digits and sum?
- Use multiple conditions in join LINQ. i,e AND
- Linq query result changing not working
- how to sortby a given value a generic type list
- Identity 2.0 Get Rolename and UserName by Linq
- Where Linq Method returning elements that don't satisfy condition
- what is output type of method when returns result of linq query?
- Linq filtering a list by a composite key (contains and not contains)
- From SQL to C# LINQ
- C# Custom Linq Provider