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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:14:00+00:00 2026-05-22T18:14:00+00:00

I want to get all rows that have count(AID)>5 When i do the query

  • 0

I want to get all rows that have count(AID)>5
When i do the query as :

SELECT x,y,z, COUNT(AID) as total from Table where ... Having total >5

It return the rows With total > 5 grouped ! but not all rows !
I want each row ..

  • 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-22T18:14:01+00:00Added an answer on May 22, 2026 at 6:14 pm

    That’s not how aggregate queries work. The count is done over a range of records (whichever ones meet the conditions of the WHERE clause) and then the HAVING clause filters out anything with a count less than 5. If you want the specific rows that contributed to the count you might try something like

    select * from
    `Table`, 
    (SELECT x,y,z, COUNT(AID) as total
       from `Table`
       where /* Some condition goes here */
       Having total >5) subqry
    where subqry.x = Table.x
    and subqry.Y = Table.Y
    and subqry.Z = Table.Z
    

    …of course, this assumes that x,y,z are a unique key for Table. If this is not the case, then this approach may not work.

    Also, are you missing a group by clause?

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

Sidebar

Related Questions

I have 3 table: [Order, Order_to_goods, Goods] I want to get of all participants
I have this query SELECT products_list.id_cat_unique, products_categories_list.*, COUNT(products_list.id_cat_unique) as counter FROM products_categories_ids LEFT JOIN
I have a select statement that returns a table full of SELECT statements (It
If all tables I want to delete from have the column gamer_id can i
What I want to do is retrieve all emails from MS SQL Customer table
In all honesty, I think the answer is no; however, I want to get
In a C# application, I want to get a list of the all the
I want to register to get notified of all Java changes in Eclipse. I
I want to get my databases under version control. I'll always want to have
I want to get an overview of files that are updated in TFS (that

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.