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

  • Home
  • SEARCH
  • 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 4256894
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:25:01+00:00 2026-05-21T05:25:01+00:00

i have this 4 tables: posts{id,post,date} comment{id, user_id,post_id, comment, date} tag_post{tag_id,post_id} users{user_id, email,pwd,username} i

  • 0

i have this 4 tables:

 posts{id,post,date}
    comment{id, user_id,post_id, comment, date}
    tag_post{tag_id,post_id}
    users{user_id, email,pwd,username}

i want to make this complex query, i want to get the maxiumum number of commenters(users) from a certain topic:
i.e.

  select the most commeneters(count) on posts that have been tagged with tag_id=39
LIMIT 5

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-21T05:25:01+00:00Added an answer on May 21, 2026 at 5:25 am

    What about something like this :

    select users.user_id, count(*) as nb_comments
    from posts
        inner join tag_posts on tag_posts.post_id = posts.id
        inner join comment on comment.post_id = posts.id
        inner join users on users.user_id = comment.user_id
    where tag_posts.tag_id = 39
    group by users.user_id
    order by count(*) desc
    limit 5
    

    It should get you the five users who commented the most on posts that have the tag 39.

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

Sidebar

Related Questions

I have 2 tables: posts tags Tags table is structured like this: post_id tag
I basically have three tables, posts, images and postimages (this simply contains the ids
i have this three tables. Table: Item Columns: ItemID, Title, Content, NoChange (Date) Table:
I have multiple tables post id Name 1 post-name1 2 post-name2 user id username
I have two tables posts and comments . Table comments have post_id attribute. I
I have to tables called USERS and COMM_HISTORY USERS(user_id, name) COMM_HISTORY(comm_history_id, comm_date, comm_by, user_id)
I have three tables: products (product_id, title) comments (comment_id, product_id, user_id, comment, post_date) bookmarks
I have a posts table structured this way: id | title | content |
I have a table posts that could look like this: id | title |
you have this 2 tables: table1 ------------- id fromId fromOtherTableId person and Table2 -------------

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.