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 8169109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:44:55+00:00 2026-06-06T20:44:55+00:00

account_users —– id | primary_key posts —– post_id | primary_key author | foreign key

  • 0
account_users
-----
id | primary_key

posts
-----
post_id | primary_key
author | foreign key to account_users.id

Let’s say I have 2 tables. account_users has the users. posts holds the posts.

How can I select all users where count(*) of posts are more than 5?

  • 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-06-06T20:44:56+00:00Added an answer on June 6, 2026 at 8:44 pm

    Try this

    SELECT au.*,p.*
    FROM account_users au
    INNER JOIN posts p
    ON p.account_users.id = au.id
    GROUP BY p.post_id
    HAVING count(*) > 5
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say that I have two models- Users and Accounts. Each account can have at
In 'ROOT_RAILS/models/users/account.rb' I have has_one :profile, :primary_key => app_profile_id, :foreign_key => id, :dependent =>
I am trying to count the number of objects with have a foreign key
In user_models.py , I have this: class Users(Base): __tablename__ = 'account_users' id = Column(Integer,
I have 2 tables - an Account table and a Users table. Each account
I have the following code in my Users controller in Rails to let users
I have these two URL's I want to make available to my users: /Account/Orders
I have website where users can login with their Facebook account. I am using
I have a web application that allows users to create an account, and in
I have controller users . In this controller I have action account which is

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.