1

I am using the following LINQ to group by a variable range (as per question here)

 var ranges = new List<decimal> { 5m, 10m, 20m };

 var grouped = entities.PointTransaction.Where( x => x.UserInfo.College == collegeID 
                  && x.Amount < 0)
                 .GroupBy( x=> ranges.FirstOrDefault( r => r >= Math.Abs( (decimal) x.Amount) )
                  ).ToList();

However, I will get the error:

single-row subquery returns more than one row

When none of the rows match any of the ranges ( say, the values are all less than 5), the query will work.

I am using DevArt Dotconnect for Oracle, Entity Framework 4

Community
  • 1
  • 1
Extrakun
  • 19,057
  • 21
  • 82
  • 129

0 Answers0