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, 9 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,331  Views
    salesforce customization

    How Salesforce Customization Services Can Help Your Business

    Blog in Salesforce

    Salesforce is known to have thousands of features used by businesses, along with customization options. Off-the-shelf Salesforce solutions might initially help a business but, moving…

    API, Automation Ttools, Bulk Data, Bulk Data Processing, Business
    360 Degree Aug 3, 2021
    2,038  Views

    Top 6 Salesforce Winter ’21 Features to Enhance Your Sales Results for CPQ

    Blog in Salesforce Products, Salesforce Releases

    Hello Everyone! It’s that time of the year again when the buzz is around the Winter ‘21 feature releases for. In this blog, we are…

    API, API Names, Automation, B2B, B2B Commerce
    LevelShift (formerly DemandBlue) Oct 21, 2020
    3,004  Views

    Popular Salesforce Videos

    Salesforce Announces New Salesforce CDP Updates | Salesforce CDP

    Salesforce Announces New Salesforce CDP Updates | Salesforce CDP

    Video in Salesforce Products

    Salesforce, one of the largest global providers of CRM solutions, launched Salesforce CDP last year. Salesforce Customer Data Platform is an enterprise customer data platform…

    salesforce, Salesforce Video, Salesforce Learning, Customer Data, Salesforce News
    nakul singh May 31, 2021
    2,219  Views
    Direct Messaging In Salesforce | Salesforce Lightning

    Direct Messaging In Salesforce | Salesforce Lightning

    Video in Lightning

    Salesforce has addressed the main challenge retailers face is replicating the one-to-one in-store interactions with their customers, and supporting a seamless buying experience. Resolving these…

    Salesforce Tutorial, Salesforce Lightning, salesforce, Salesforce Video, Customers
    Algoworks Aug 3, 2021
    3,186  Views
    Data Archiving in Salesforce | Backup and Restore

    Data Archiving in Salesforce | Backup and Restore

    Video in Data, Salesforce Training

    Learn the techniques, patterns and strategies when it comes to handling data archiving, backup and restores. Watch this video and learn all about Data Archiving…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Learning, Techniques
    Abhishek Sep 24, 2021
    2,078  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.