mysql> select user_name from content where content_body like "%世界杯%" group by user_name;这样取的所有了 发过 世界杯 的人    想同时把这些user_name发的多少条给取出  怎么写?

解决方案 »

  1.   

    select count(id) from content where content_body like "%世界杯%" group by user_name;
      

  2.   

    select count(id) as countnum,user_name from content where content_body like "%世界杯%" group by user_name;
      

  3.   

    select user_name count(content_body) from content where content_body like "%世界杯%" group by user_name;
      

  4.   

    上面少了一个逗号,修改一下:
    select user_name, count(content_body)
    from content where content_body like "%世界杯%" group by user_name;