Solved

MySQL query pull data greater than 20

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

622 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