[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

MySQL query pull data greater than 20

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
pda4me
Asked:
pda4me
  • 2
1 Solution
 
derekkrommCommented:
select officename from agent group by officename having count(*) > 20
0
 
alagurjanTechnology LeadCommented:
i think in the above query good to add this small change :)

select distinct(officename) from agent group by officename having count(*) > 20
0
 
derekkrommCommented:
shouldn't need the distinct with the group by
0
 
pda4meAuthor Commented:
Worked AWESOME!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now