Toggle Side Panel

  • Blogs
  • Consultants
    • Salesforce Product Expertise
      • Top Salesforce ConsultantsTop Salesforce Consultants
      • Marketing Cloud ConsultantsMarketing Cloud Consultants
      • Service Cloud ConsultantsService Cloud Consultants
      • Experience Cloud ConsultantsExperience Cloud Consultants
      • Analytics Cloud ConsultantsAnalytics Cloud Consultants
    • Salesforce Industry Expertise
      • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
      • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
      • Health Cloud ConsultantsHealth Cloud Consultants
      • Commerce Cloud ConsultantsCommerce Cloud Consultants
      • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
    • Salesforce Experts by Location
      • USATop Salesforce Consultants in USA
      • IndiaTop Salesforce Consultants in India
      • AustraliaTop Salesforce Consultants in Australia
      • United KingdomTop Salesforce Consultants in UK
      • CanadaTop Salesforce Consultants in Canada
  • Webinars
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Blogs
    • Consultants
      • Salesforce Product Expertise
        • Top Salesforce ConsultantsTop Salesforce Consultants
        • Marketing Cloud ConsultantsMarketing Cloud Consultants
        • Service Cloud ConsultantsService Cloud Consultants
        • Experience Cloud ConsultantsExperience Cloud Consultants
        • Analytics Cloud ConsultantsAnalytics Cloud Consultants
      • Salesforce Industry Expertise
        • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
        • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
        • Health Cloud ConsultantsHealth Cloud Consultants
        • Commerce Cloud ConsultantsCommerce Cloud Consultants
        • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
      • Salesforce Experts by Location
        • USATop Salesforce Consultants in USA
        • IndiaTop Salesforce Consultants in India
        • AustraliaTop Salesforce Consultants in Australia
        • United KingdomTop Salesforce Consultants in UK
        • CanadaTop Salesforce Consultants in Canada
    • Webinars
    • Contact Us
    • Discussions
    Close search

    Activity › Forums › Salesforce® Discussions › Salesforce Query to Get the list of accounts where Related contacts Greater than 200

    Tagged: Account List, Account List in Salesforce, Accounts in Salesforce, Contact List in Salesforce, Contact Object, Contact Record, Salesforce List, Salesforce Object Query Language, Salesforce Query

    • Salesforce® Discussions

      Salesforce Query to Get the list of accounts where Related contacts Greater than 200

      Posted by subramanyam subbu on January 31, 2018 at 3:40 PM

      hi all,

      Is it possible to write a query to get a list of accounts where associated contacts greater than 200?

      Mohit replied 8 years, 6 months ago 2 Members · 1 Reply
      • Account List
      • Account List in Salesforce
      • Accounts in Salesforce
      • Contact List in Salesforce
      • Contact Object
      • Contact Record
      • Salesforce List
      • Salesforce Object Query Language
      • Salesforce Query
    • 1 Reply
    • Mohit

      Member
      February 1, 2018 at 9:38 AM

      Hi Subramanyam Subbu,
      Yes, it is possible to query the list of Accounts where Associated Contacts greater than 200.
      For this, we can use the Aggregate query to fetch the AccountId of those Account record having related contact greater than 200.
      Here is the Code below:-

      AggregateResult[] groupedResults = [select AccountID from Contact GROUP BY AccountID HAVING count(AccountId)>200];

      for (AggregateResult ar : groupedResults) {

      System.debug('Account ID' + ar.get('AccountID'));

      }
      Hope this may help you.

      Thanks,
      Mohit Agarwal

    Log In to reply.

    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me

    Popular Salesforce Blogs

    Salesforce vs ERP: Understanding the Key Differences

    Blog in Others

    It's very common to encounter misconceptions about Salesforce being just another ERP system. However, understanding the distinct functionalities and capabilities of Salesforce compared to traditional…

    api-integration, Business Efficiency, Business Management, Cloud Based CRM, Comprehensive Insights
    Emorphis Jun 25, 2024
    1,152  Views
    salesforce consult

    Planning to Hire a Salesforce Nonprofit Consultant? Here’s What you Need to Know

    Blog in Salesforce Consultant

    Why would you need a strategy to hire a consultant, right? Like go on an XYZ review website and hire the best one? Simple? No?…

    Communicate with Clients, community, Consultancy Firm, consultant, Consultation Charges
    CRMJetty Sep 18, 2020
    3,141  Views
    Campaigns In Salesforce

    Campaigns In Salesforce - All You Need to Know

    Blog in Others, Salesforce

    What is a Salesforce Campaign? A Salesforce Campaign is a collection of Leads and Contacts who have been exposed to a certain marketing message(s). It…

    Budgeted Cost, Campaign, Campaign Member, Campaigns In Salesforce, Campaigns Tab
    Anjali Jul 12, 2021
    5,746  Views

    Popular Salesforce Videos

    Salesforce Tutorial | Salesforce Summer '20 Release

    Salesforce Tutorial | Salesforce Summer '20 Release

    Video in Salesforce Training

    It's time for another Salesforce release. In this video, we talk about all of the new features that the Summer '20 release will give us.…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Video, Salesforce Learning
    Stimulus Consulting Jul 24, 2020
    1,798  Views
    All About Public Group in Salesforce

    All About Public Group in Salesforce

    Video in Others, Salesforce Apex

    Public Group represents a custom group of users defined by an administrator. Users can be added to a public group individually, or based on their…

    Salesforce Training, salesforce, Salesforce Video, Salesforce Learning, Administrator
    Prafull Jan 27, 2021
    2,015  Views
    Algoworks Is Now A Salesforce Summit (Platinum) Partner | Salesforce Consulting Services

    Algoworks Is Now A Salesforce Summit (Platinum) Partner | Salesforce Consulting Services

    Video in Salesforce Consultant

    It's been just a year since we became Salesforce gold consulting partners. Algoworks has now been recognized as a Salesforce Summit Partner (also known as…

    Salesforce Training, Salesforce Tutorial, salesforce, salesforce consulting services, Salesforce Video
    Algoworks May 10, 2022
    1,548  Views
    Footer Forcetalks logo

    support@forcetalks.com

    • twitterx

    Quick Links

    Advertise with Us

    Salesforce® Articles

    Dreamforce 2023

    Top Salesforce® Bloggers 2023

    Top Salesforce Consultants

    Get Listed

    Company

    Contact Us

    About Us

    Privacy Policy

    Terms & Conditions

    InsightHub

    Salesforce Blogs

    Salesforce Videos

    Salesforce Groups

    Salesforce Jobs

    © 2026 - Forcetalks ● All Rights Reserved

    Salesforce® is a trademark of Salesforce® Inc. No claim is made to the exclusive right to use “Salesforce”. Any services offered within the Forcetalks website/app are not sponsored or endorsed by Salesforce®.

    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.