Solved

MySQL query pull data greater than 20

Posted on 2011-03-09
4
244 Views
Last Modified: 2012-05-11
i have a table called agent.  this table has a field called officeName.  

How do I select all distinct officeName where there are more than 20 instances of agents for that office?
0
Comment
Question by:pda4me
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
derekkromm earned 500 total points
ID: 35083334
select officename from agent group by officename having count(*) > 20
0
 
LVL 2

Expert Comment

by:alagurjan
ID: 35083701
i think in the above query good to add this small change :)

select distinct(officename) from agent group by officename having count(*) > 20
0
 
LVL 15

Expert Comment

by:derekkromm
ID: 35083709
shouldn't need the distinct with the group by
0
 

Author Closing Comment

by:pda4me
ID: 35083739
Worked AWESOME!
0

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question