Sorry, typo on that...
a.orderid
I dont believe this will work a my Date column is not in the customer entity but in the order entity.
Instead of trying to break this down into a common analogy, maybe I should just leave the context so I don't confuse the issue trying to put a northwind twist on it...
What I have are games and serial numbers, games have multiple serial numbers and there may be multiple entries for serial numbers for a particular game that is the same serial number. So, GameEntity 1 may have two serial number entities of 12345. Lets say it also has a single serial number entity of 6789 for comparison. I want my serial collection to only have the most recent serial entity for any uniqe serial number. So for the above scenario my results would be...
gameid serialid serialnumber submitteddate
1 1 6789 1/1/2006
1 3 12345 5/31/2006
the following should be omitted because it is not the most recent serial entity in the game.Seral collection
1 2 12345 2/28/2006
Here is the sql that gives me the results I need...
select *
from serial a
where a.serialid = (select top 1 serialid from serial where gameid= a.gameid order by submitteddate desc)
order by a.gameid
Let me play around with this and try some real code. thank you.