Each GROUP BY expression must contain at least one column that is not an outer reference
Group by constant value is not possible e.g.
var query = from cc in Repo.AsQueryable() group cc by 1 into g select new { MinLogId=g.Min(f=>f.Id), MaxLogId=g.Max(f=>f.Id), }
throws Operation 'ExecuteReader' throws exception 'BLToolkit.Data.DataException: Each GROUP BY expression must contain at least one column that is not an outer reference.
What Sql are you expecting? for ex. for MSSQL query
select max(ParentId), max(ChildId)
from Child
group by 1
raise error - Group by should contain at least one field
If you do need just min & max you can do:
cc.Select(_ => (int?)_.Id).Max();
Hi ili
expected query should be: select min(LogId), max(LogId) from Archive
without grouping statement.
There is also need for example for Summing more then one value over the whole table: select Sum(IsNew), Sum(IsOpen), Sum(IsClosed) from something
As you have proposed is an workaround which I am already using just that are two queries on DB resp. more than one if more columns are needed.
br.