This is a migrated thread and some comments may be shown as answers.

Is Group By Supported?

3 Answers 94 Views
OQL (OQL specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Brendan Enrick
Top achievements
Rank 1
Brendan Enrick asked on 12 Nov 2009, 02:40 PM
Is it possible to perform a group by to get grouped results with aggregate functions?

3 Answers, 1 is accepted

Sort by
0
Damyan Bogoev
Telerik team
answered on 13 Nov 2009, 11:40 AM
Hello Brendan Enrick,

It is possible perform a group by to get grouped results with aggregate functions. To achieve this goal you should do a query of the following format:

var customers =
    from c in scope.Extent<Customer>()
    group c by c.Country into g
    select new { Key = g.Key, Count = g.Count() };

I think that will help you.


Kind regards,
Damyan Bogoev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Derek
Top achievements
Rank 1
answered on 25 Sep 2014, 07:04 PM
Is there way to do something like this using the OpenAccessLinqDataSource, or can it only be done through code-behind?
0
Doroteya
Telerik team
answered on 29 Sep 2014, 06:49 AM
Hello Derek,

It is possible to achieve the same result with OpenAccessLinqDataSource. An example of the implementation is available in the Data Binding with OpenAccessLinqDataSource sample (the Using Aggregates on Grouped Data section) in our Samples Kit. The exact settings are available in the documentation of the sample, the Using Aggregates on Grouped Data task. You can open the documentation by selecting the sample in the samples grid and clicking on the Open Documentation... button.

I hope this helps. If you need additional information, do not hesitate to get back to us.


Regards,
Doroteya
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
Tags
OQL (OQL specific questions)
Asked by
Brendan Enrick
Top achievements
Rank 1
Answers by
Damyan Bogoev
Telerik team
Derek
Top achievements
Rank 1
Doroteya
Telerik team
Share this question
or