日期:2014-05-20 浏览次数:20953 次
select top 5 authorName,count(*) from dbo.authors group by authorName having authorName like '赵%' order by count(*) desc
V1DataContext DB = new V1DataContext(); var queryName = (from A in DB.authors group A by new { authorName = A.authorName } into grA select new { authorName = grA.Key.authorName, Quantity = grA.Count() } into orderbygrA where orderbygrA.authorName.StartsWith("张") orderby orderbygrA.Quantity descending select orderbygrA.authorName).Distinct().Take(7);
var query=(from A in DB.authors.Where(b=>b.authorName.StartsWith("张")) group A by A.authorName into g let c=g.Count() orderby c desending select new {authorName=g.Key,cnt=c}).Take(5);