Toggle Side Panel

  • Home
  • Articles
    • All Articles
    • Blogs
    • Videos
    • Infographics
  • 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
  • Marketplace
  • Advertise With Us
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Home
    • Articles
      • All Articles
      • Blogs
      • Videos
      • Infographics
    • 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
    • Marketplace
    • Advertise With Us
    • 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 7 years, 10 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

    application solution

    Popular Salesforce Blogs

    salesforce visualforce angularjs

    How to develop Salesforce Visualforce apps using AngularJS ?

    Blog in Others

    If you need to display Salesforce data to people other than those that have Salesforce accounts, Visualforce pages is the best way to go. It…

    Binding Data, ContactsController, Custom Salesforce Apex, JavaScript, JavaScript Remote Objects
    Algoworks Jul 30, 2020
    5,190  Views
    Salesforce Pardot

    Getting Started With Salesforce Pardot | The Basics

    Blog in Others, Salesforce Products

    Pardot Pardot is Salesforce's B2B selling automation robotization arrangement. In case you're a business that offers to various organizations (or B2B), Pardot can computerize your…

    Associations, Automation Robotization, B2B Selling, Best Possibilities, Business
    Ratnesh Apr 9, 2021
    3,651  Views

    Salesforce CRM, NetSuite ERP Integration: Benefits, Guide, Best Practices

    Blog in Salesforce integration

    NetSuite is the #1 Cloud ERP. In 2022, NetSuite became a leader in the Gartner Magic Quadrant for Cloud ERP for Service-Centric Enterprise. As you…

    Automated Workflows, Business Growth, Business Scalability, Celigo Connector, Client Onboarding
    Sparkybit Nov 17, 2023
    2,433  Views

    Popular Salesforce Videos

    What is a Salesforce PDO Partner?

    What is a Salesforce PDO Partner?

    Video in Salesforce Stories

    Salesforce market is growing very fast these years. It is estimated that in 2021 the Salesforce ecosystem will be worth around 100 billion U.S. dollars.…

    Salesforce Products, Salesforce Integration, Salesforce Partner, salesforce, Salesforce Ecosystem
    Algoworks May 18, 2021
    2,307  Views
    Dreamforce 2021 Main Keynote - Welcome to the Trusted Enterprise | Salesforce

    Dreamforce 2021 Main Keynote - Welcome to the Trusted Enterprise | Salesforce

    Video in Salesforce Stories

    Today, every business has to transform to become a Trusted Enterprise. Join Marc Benioff & special guests to learn how Customer 360 helps businesses of…

    Salesforce Training, Salesforce Tutorial, dreamforce, salesforce, salesforce knowledge
    Nauman Oct 5, 2021
    2,472  Views
    Custom Settings and Custom Metadata Explained | 3-Minute | Salesforce Tutorial

    Custom Settings and Custom Metadata Explained | 3-Minute | Salesforce Tutorial

    Video in Salesforce Development

    In this video, Alex walks you through Custom Settings and Custom Metadata types in Salesforce and the difference between them. Discover how ENWAY can assist…

    Apex, Custom Settings in Salesforce, Metadata, Custom Setting, Custom Metadata Types
    ENWAY Nov 24, 2023
    845  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

    © 2025 - 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®.

    Try AuditMyCRM - It is a Salesforce CRM Audit tool which comprehensively scans your Salesforce org and gives you the list of errors or warnings you need to take care of.
    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.