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, 11 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 Lightning

    Why Should You Consider Migrating To Salesforce Lightning In 2022?

    Blog in Lightning

    Salesforce has been in the industry for over two decades and has already carved its niche in the market. The CRM platform has been consistent…

    app development, Applications, Aura Framework, Business Goals, Business Process
    Manish Pandey Jan 27, 2022
    3,532  Views

    The Amazing ways Salesforce Community Cloud Can Help you in

    Blog in Salesforce Implementation

    Communities can be utilized to furnish your clients and accomplices with a more extravagant, smoother administration by enabling them to discover data on your business,…

    Commerce Cloud, Commerce Cloud Einstein, Salesforce Adminstrator, Salesforce Cloud, Salesforce Community
    William Jun 18, 2019
    3,430  Views

    The Importance of a Salesforce Consulting Company in Achieving Business Objectives

    Blog in Salesforce

    Introduction A Salesforce development company simply put, is a company that helps piece multiple fragments of a business together, helps in centralized data flow and…

    app development, Associated Costs, Better Adoption, Business, Business Needs
    Meenu May 17, 2023
    1,773  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,327  Views
    Salesforce Interface Sends a Command With Parameters to UiPath Assistant Using JavaScript

    Salesforce Interface Sends a Command With Parameters to UiPath Assistant Using JavaScript

    Video in Salesforce Apex, Salesforce Training

    Salesforce interface sends a command with parameters to UiPath Assistant using Robotjs Code: https://github.com/cristinegulescu/startUiPathFromSalesforce/blob/master/SalesForceLocal.txt  

    Salesforce Training, Salesforce Tutorial, Salesforce Video, Javascript, Salesforce Learning
    Cristian Nov 25, 2020
    1,418  Views
    Sales Process in Salesforce | Opportunity Object Explained

    Sales Process in Salesforce | Opportunity Object Explained

    Video in Salesforce Consultant

    Opportunities in Salesforce Sales Cloud allow sales teams to organize and track their sales pipeline effectively. Each opportunity represents a potential deal, and it can…

    salesforce, Opportunities, Sales Process, Opportunity, Opportunity Record
    ENWAY Jul 5, 2024
    557  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®.

    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.