Open
Description
A query like this:
var result = db.OrderLines
.GroupBy(x => new {x.Order.OrderId,x.Order.OrderDate})
.Select(x => new { OrderIdString = x.Key.OrderId.ToString(), x.Key.OrderDate, Count=x.Count() })
.ToArray();
where the grouping is done on a join and the projection uses ToString on the Id, results in
select cast(order1_.OrderId as nvarchar(50))
and
group by orderline0_.OrderId
One of these uses the wrong table. I think it could be argued that it's the "group by" which choses the wrong table/column, but that would be a bigger change.