I can't imagine this isn't possible and it probably isn't even that hard, but I can't get it working.
How do I create a predicate expression to generate the following SQL query:
SELECT * FROM Workflow as W1
WHERE W1.[Version] = (SELECT MAX([Version]) FROM Workflow AS W2 WHERE W2.Code = W1.Code)
The idea is to fetch the Workflow records with the highest version. The Code field is a unique key.