Solved

MySQL query pull data greater than 20

Posted on 2011-03-09
4
243 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
  • 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

'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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

828 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