score:1
Your query structure is:
from t in (
)
select new {
Column1 = .Sum(p => p.TotalUserActions), // here is the error
Column2 = .Sum(p => p.AllTotalPoints), // and here
}
You must use the t
alias in result, like this:
from t in (
)
select new {
Column1 = t.Sum(p => p.TotalUserActions),
Column2 = t.Sum(p => p.AllTotalPoints),
}
But you must have such fields in your resulting query, which is not true right now.
I think you should write your query in SQL and transmit it to LINQ step by step. Right now it's very confusing and bug producing.
Update:
You've got the error because of your code doesn't contain such fileds. What should contain fields TotalUserActions
and AllTotalPoints
? Try to sum all Points
fields, but can't say what the TotalUserActions
is:
from t in (
)
select new {
Column1 = t.Sum(p => p.TotalUserActions),
Column2 = t.Sum(p => p.Points),
}
Source: stackoverflow.com
Related Query
- Linq Anonymous type members must be declared in Sub Query
- LINQ: Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access
- Linq error generic parameter or the query must use a nullable type
- LINQ select query with Anonymous type and user Defined type
- LINQ query with GROUP BY and Count(*) into Anonymous Type
- Convert KeyValuePair to anonymous type in a LINQ query
- linq query anonymous type cannot be converted to POCO object
- How to convert Anonymous Type to Strong Type from LINQ query
- What is the return type for a anonymous linq query select? What is the best way to send this data back?
- conditionally populating anonymous type member in linq query
- How to turn LINQ query into anonymous type
- Return Anonymous type from LINQ query in VB.NET
- .NET service OData return anonymous type from LINQ query
- Linq sub query when using a repository pattern with EF code first
- Convert nullable int to int in linq query return anonymous type
- Possible to assign a data type to an anonymous type's members in a linq query?
- Setting all properties of dynamic object in anonymous type in linq query
- nested Linq Query Returned an error at run time(Unable to create a constant value of type Anonymous type)
- How to create an anonymous type within linq query with TypeScript
- How to Select top (5) contributors group by Business type code in c# linq query
- error when anonymous type is used in join query in LINQ
- Select query on type to transform it into its sub type using Linq
- Why is this linq query with anonymous type faster than anything else I try?
- How to access anonymous type projected in Linq query in the next chained extension method?
- Using LINQ to query three entitites. - Include path expression must refer to a navigation property defined on the type
- give type to anonymous type in linq query
- Linq Query return Anonymous Type Error
- returning specified type for a linq query with anonymous type
- why can I only access the properties of an anonymous type when I add .toList to the end of my linq query
- Problem referring to members of an anonymous type in linq
More Query from same tag
- How to get the value in an xml section, and if not present set the value as null?
- RegEx for LINQ like syntax
- Cast ITable to IEnuerable<object> - Dynamic LINQ to SQL Query with no DataTable information
- TransactionScope vs Transaction in LINQ to SQL
- Mix Entity Framework Linq with stored procedure
- Flatten list of dynamic objects in c#
- Optimise and speed up very slow Linq / SQL code
- How to add multiple records in List along with other model in view-model Linq - ASP.NET-MVC5
- LINQ to Entities error using SequenceEqual enumerable method
- How to use DateTime in Expressions for LINQ to Entities?
- Operator '==' cannot be applied to operands of type 'int' and 'string'
- Get results for sub query with matching values from a List
- Best practise in splitting up query result by a column
- How to use/enable LINQ combined with custom serializer? (MONGODB C#)
- Dynamic LINQ
- Linq - Grouping by date and selecting count
- Alias from clause
- Entity Framework -- How are Canonical Functions Different from Linq -- Linq-to-Entities vs Canonical Functions
- Duplicates while querying Three tables to get Common values using LINQ.
- How do I fill the "var" from a LINQ query into the same datatable?
- How can i compare the variable var with the enum in C#
- send email birthdate to all contact in CRM 365 with workflow C#?
- LINQ Ordery by two fields
- Linq2Sql Join Into DefaultIfEmpty
- C# LINQ to rank time series values on a daily basis => partition by date, then rank by value (largest to smallest)
- Trying to retrieve data from multiple related tables in mysql from very big data
- search in ICollection entity
- LINQ TO DataSet: Multiple group by on a data table
- Stored Procedure Results Return Null When Where Clause is Added in LINQ
- Can I change an XText object into a string with character references and entities resolved?