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, 8 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 Connect

    Salesforce Connect - Quick Start | Apex Developer Guide

    Blog in Salesforce

    Salesforce Connect is a cloud integration service that has a game-changing performance in the world of Salesforce. As with the help of this service, you…

    Backend Systems, Bulky Data, Business, Cloud Integration Service, Complex Processes
    SP Mar 17, 2021
    2,669  Views
    Data Classification in Salesforce

    Protect your Data with Data Classification in Salesforce

    Blog in Data

    Happy Cybersecurity Awareness Month (CSAM)! Did you know that the loss of critical, and often sensitive, information can severely impact the profitability and innovation of your…

    Business-critical Financial Records, Classify Data, Cleanup Project, Compliance Categorization, Confidential Data
    Netwrix Oct 18, 2021
    5,958  Views

    Introducing SalesPath in Salesforce: An Interactive Guide

    Blog in Others

    Ever Heard of Sales Path? Okay, let's dive deeper! Imagine this scenario: You're a sales rep at a tech company. You've just landed a meeting…

    Cloudy Aug 1, 2025
    413  Views

    Popular Salesforce Videos

    Create Custom App in Salesforce | Salesforce Training

    Create Custom App in Salesforce | Salesforce Training

    Video in Salesforce Apps

    Following Pointers are included in this video: 00:00:00 Agenda 00:00:36 What is Cloud Computing? 00:03:12 What is Salesforce? 00:05:21 Benefits of Cloud computing & Salesforce…

    Salesforce Training, Salesforce Tutorial, CRM, Cloud Computing, Salesforce Video
    Jogender Apr 22, 2022
    1,611  Views
    Salesforce Document Automation

    Salesforce Document Automation

    Video in Salesforce Automation

    Salesforce recently announced the release of an Intelligent Document Automation tool aimed at allowing healthcare and life sciences companies to digitize document-management processes. The tool,…

    Salesforce Training, Salesforce Tutorial, salesforce, Healthcare, Salesforce Video
    Algoworks Mar 26, 2021
    2,019  Views
    Can I Get a Job by Just Learning Salesforce Admin?

    Can I Get a Job by Just Learning Salesforce Admin?

    Video in Salesforce Training, Salesforce Admin

    In this Video Shrey covered the following questions: 1. Can I get a job by just learning Salesforce Admin? 2. Can you start a career…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Admin, Salesforce Video
    Abhishek Oct 18, 2021
    2,634  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.