If I have a sql table that contains
ProductID
Price
Date
and I wish to find the latest price for a given date. In Sql I can do something like
` Select * from (
select ROW_NUMBER() OVER (PARTITION BY ProductID ORDER BY Date DESC) AS row_number,
ProductID, Date, Price from ProductPrices
where date < @targetDate
) tempTable
where row_number = 1 `
Is it possible to do this easily in LinqToSql? My attempts have all ended up issuing on sql command per product?