日期:2014-05-19  浏览次数:20471 次

求条SQL语句
统计一个表里的会员发帖记录数..并按发帖量降序排列

信息表:
ID(帖子ID),Name(会员名)

------解决方案--------------------
create table test
(
id int identity primary key,
name varchar(20)
)
go

insert into test values( 'aa ')
insert into test values( 'aa ')
insert into test values( 'aa ')
insert into test values( 'bb ')
insert into test values( 'cc ')
insert into test values( 'cc ')
go

select * from test

select count(id) '发帖量 ',name
from test
group by name
order by '发帖量 ' desc