T-SQL,LINQ取集合当中的重复项

T-SQL:

select * from Articles where Title in(Select Title From Articles Group By title Having Count(*) > 1) order by title

LINQ:

from t in Articles where 
(from t1 in Articles group t1 by t1.Title into groupT
where groupT.Count()>1 select groupT.Key).Contains(t.Title) orderby t.Title 
select t

 

posted @ 2016-03-07 17:41  活在云里雾里梦里  阅读(114)  评论(0)    收藏  举报