3 ms·
> No-one really uses the SQL-esque langugage. Of course we do. I wrote this just the other day: var salesAndReturns = from sale in sales join return i
by ilitirit 12y ago
> No-one really uses the SQL-esque langugage.
Of course we do. I wrote this just the other day:
var salesAndReturns = from sale in sales
join return in returns on new { StockId = sale.StockId, ClientStockId = sale.ClientStockId, SellPointId = sale.SellPointId }
equals new { StockId = return.StockId, ClientStockId = return.ClientStockId, SellPointId = return.SellPointId } into gpu
from subreturn in gpu.DefaultIfEmpty()
select new
{
sale.ClientStockId,
sale.StockId,
Quantity = -sale.Quantity + (subreturn ?? new SellPointStock()).Quantity
};
The are no rules restricting us from how we should use LINQ.