码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2016-03-07 18:38:19      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:

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

 

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

标签:

原文地址:http://www.cnblogs.com/zooni/p/5251322.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!