This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
We're wondering if the following scenario is supported: var test = _unitOfWork.Payments.AvoidTableLocking() .Where(p => p.CreatedOn >= startDate && p.CreatedOn <= endDate) .GroupBy(p => p.ReceiverId).Select(group => group.Count()).ToArray(); This generates two SQL queries, the first one which actually does the grouping, but the second one pulls down the entire Payments table. Is there any way to perform operations such as sum, average, count etc on a grouping w/o pulling down the entire table? |
|
|
If you are using LINQ there will always be at least 2 queries as we need to initially fetch the grouping sets with the first query and then then there will be one query per set to fetch the results. You can express this as a single query however using the LightSpeed querying API. There is some documentation on how to express a grouping query on this page in the documentation: http://www.mindscapehq.com/documentation/lightspeed/Advanced-Querying-Techniques/Exploring-the-Query-Object Let us know if you have any specific follow up questions on this.
|
|