Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6104721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:52:27+00:00 2026-05-23T13:52:27+00:00

I have a forum. I want to perform an SQL query so I can

  • 0

I have a forum. I want to perform an SQL query so I can get the user who has the most blog submissions. I have 2 tables, blogs and users.

The blogs table has author_id which is the user_id from the users table.

So here is what I tried to do but without success:

SELECT b.author_id FROM blogs b 
INNER JOIN users u ON b.author_id = u.user_id 
ORDER BY count(author_id) DESC 
GROUP BY b.author_id 
LIMIT 0,10;

Could you please help me to find the user with most blog submissions, or in other words, I need to find a author_id that has most occurrence in the blogs table. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:52:27+00:00Added an answer on May 23, 2026 at 1:52 pm

    You don’t need to join to users for this, you just need a GROUP BY and a LIMIT:

    SELECT author_id
    FROM blogs
    GROUP BY author_id
    ORDER BY COUNT(*) DESC
    LIMIT 1
    

    The GROUP BY tells the COUNT which groups it should count; in this case, it should collect up the blogs for each author_id and count those as a single group.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Windows Form.Now i want to perform some function when the form get
I have functions I want to perform after my app has finished initialising and
I have two tables - forum_topics and topics_posts . I want to select rows
I want to perform some operations on newly registered user when he hits the
I have 2 submit buttons and want to perform different actions for each submit
I have a button_to that I want to perform a PUT action (there is
I have a form-1 which has 4 fields. when the user inputs data in
I have a table of forum posts, and want to improve the basic search
In my SQL I have 2 tables: film = filmid, filmname and review =
I have a text box on a form and want to perform different actions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.