I'm trying to create a Linq query for EF that joins on 2 values from an inner select. Underneath you will find the SQL query that does the trick, things are much more tricky when trying to do so in Linq.
I use POCO object and would like the query to return the List and not an anonymous type. Is this possible with Linq to EF?
SELECT s1.*
FROM [Statistics] s1
INNER JOIN
(
SELECT MAX(CreateDate) as createdate
FROM [Statistics]
GROUP BY UserId
) s2
ON s1.UserId = s2.[UserId] and s1.CreateDate = s2.createdate
ORDER BY s1.Balance desc