我想让统计数据表A里发布文章最多的会员名 从发布最多的会员降序排列下来 SQL语句怎么写呢??
就是说统计发布最多的会员 从多到少 排列下来!
数据表=A 会员名=username 标题=title 标题ID=id 

解决方案 »

  1.   


    select username,COUNT(1) AS SL  FROM A GROUP BY username
    order by SL DESL
      

  2.   


    --不要发表文章数
    select username from A group by username order by count(1) desc--加上发表文章数
    select username, count(1) as num from A group by username order by num desc
      

  3.   

    貌似不对哦。。
    还是 SL 是什么意思呢?条件是这样:文章数据表=A 发布文章的会员名=username 文章标题=title 文章标题ID=id 会员数据表=B 会员ID=userid