LINQ experts, I am looking to update the latest data on a per user basis, to explain say I have a table "dummy":
CREATE TABLE [dbo].[dummy](
[Id] [int] IDENTITY(1,1) NOT NULL,
[TimeStamp] [datetime] NOT NULL,
[UserId] [int] NOT NULL,
[TransAmount] [decimal](10, 4) NOT NULL
) ON [PRIMARY]
What I am looking to do is get the latest record for each UserId, using SQL I would use something like:
select * from dummy d1 join
(
select max(id) as id
from dummy d1
Join (select distinct userid from dummy) d2 on d1.userid = d2.userid
group by d1.userid)
as d2 on d1.id = d2.id
but I am looking to do this using LINQ.
Thanks.