日期:2014-05-20 浏览次数:20649 次
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);