Solved

MySQL query pull data greater than 20

Posted on 2011-03-09
4
240 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
Comment Utility
select officename from agent group by officename having count(*) > 20
0
 
LVL 2

Expert Comment

by:alagurjan
Comment Utility
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
Comment Utility
shouldn't need the distinct with the group by
0
 

Author Closing Comment

by:pda4me
Comment Utility
Worked AWESOME!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now