mysql - Geting the most count by id -


i have forum. want perform sql query can user has blog submissions. have 2 tables, blogs , users.

the blogs table has author_id user_id users table.

so here tried without success:

select b.author_id blogs b  inner join users u on b.author_id = u.user_id  order count(author_id) desc  group b.author_id  limit 0,10; 

could please me find user blog submissions, or in other words, need find author_id has occurrence in blogs table. thanks!

you don't need join users this, need group , limit:

select author_id blogs group author_id order count(*) desc limit 1 

the group tells count groups should count; in case, should collect blogs each author_id , count single group.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -