求一个简单的linq语句
如图,我想用linq实现根据guid中的值来分组,每组取一行数据
图中我想要的结果为
1 aaa 123
2 bbb 654
3 CCC 780
用linq该如何写呢? linq
[解决办法]
select Guid,Name,Tel
from
(
select *,rn=ROW_NUMBER() OVER(partition by Guid ORDER BY getdate()) from tb
)t
where rn=1
select [Guid],Name,Tel
from
(
select *,ROW_NUMBER() OVER(partition by Guid ORDER BY getdate()) num from tb
)A
where num=1