-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GroupBy with subselect expression #343
Comments
Looks like a general SQL Server error. |
I don't think that this is sql server error. This is sql default behaviour. I am thinking that after grouping with using subselect column in order to find count of rows for each group, generated sql should be nested select. For example;
|
I mean that the error message ('...group by list of a GROUP BY clause') indicates that the error originates from the SQL Server rather than from EF or our code.
We don't generate SQL, we build LINQ queries that are translated into SQL by a LINQ provider. When we build a Would you please share |
Thanks for the response. Below you can find our loadOptions.
|
Thanks but this code snippet is not helpful. Basically, I'm asking for the same information as in #332. |
I copied load options values.
|
Thank you for the update. var result = (/* your source query with joins */);
var groups = result
.GroupBy(obj => new {
I0 = obj.WorkOrderCode
})
.OrderByDescending(g => g.Key.I0)
.Select(g => new {
I0 = g.Count(),
I1 = g.Key.I0,
I2 = g.Sum(obj => obj.OrderQuantity)
})
.ToArray(); Would you please check whether or not it is executed with the same 'Cannot use an aggregate...' error? |
The problem is here WorkOrderCode is coming from sub query (You can look at my first code snippet). We are not writing GroupBy clause. GroupBy clause is coming from remote grouping functionality of DevExtreme grid. |
This is clear. Have you had a chance to check the manually written |
I know that my question can be related with entity framework issue but when i want to use remote grouping to group records according to sub select column i am getting "Cannot use an aggregate or a subquery in an expression used for the group by list of a GROUP BY clause" error. As far as I see from generated query, remote grouping is trying to find number of records for each group. Below you can see my linq query and generated sql. Do you have any idea to solve this problem ?
Note : On data grid, I am trying to group with using "WorkOrderCode" column.
Generated SQL
The text was updated successfully, but these errors were encountered: