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 8 years, 1 month 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

    Inserting Records in Account or (any other sObject) Through Postman in salesforce

    Inserting Records in Account or (any other sObject) Through Postman in Salesforce

    Blog in Salesforce Apex

    We are using postman from API testing and request management to hit API by get or post and received data in the form of JSON…

    connected app, oAuth2, Postman, Rest API, Salesforce
    Nitin Aug 29, 2017
    30,686  Views
    Steps to enable Chatter and Social Media in Salesforce

    Steps to enable Chatter and Social Media in Salesforce

    Blog in Others

    Here we will learn how to enable social media and chatter in Salesforce. Let's start from a contact tab and see how it looks without…

    Chatter File, Contact Tab, Marketing Cloud Social Media Management, Profile Page, Salesforce Account
    Parul Sep 18, 2018
    5,469  Views

    What is Salesforce Community Cloud?

    Blog in Others, Salesforce, Salesforce Cloud Platform

    Originally named ‘Salesforce Customer and Partner Portals’, Community Cloud is among the most popular cloud options from Salesforce. As with the rest of the platform,…

    Community Licences, Community Management Console, Customer 360-degree view, Lightning Platform Starter, Salesforce Community Cloud
    Pexlify Feb 21, 2020
    14,546  Views

    Popular Salesforce Videos

    Watch and Learn with Salesforce Developers

    Watch and Learn with Salesforce Developers

    Video in Salesforce Training

    Salesforce Developers are creators that live on the cutting edge of technology and innovate with the newest tools. The Salesforce Developer YouTube Channel is here…

    Salesforce Training, Salesforce Tutorial, Salesforce Development, Salesforce Developers, Salesforce Video
    Nauman Sep 7, 2021
    1,598  Views
    Salesforce Consultant Career | Salesforce Career Path | Salesforce Consultant Certification

    Salesforce Consultant Career | Salesforce Career Path | Salesforce Consultant Certification

    Video in Salesforce Certifications, Salesforce Consultant

    If you're interested in becoming a Salesforce consultant, one of the first things to consider is how much education you need. We've determined that 60.2%…

    Salesforce Training, Salesforce Certification, salesforce consultants, Salesforce Video, Salesforce Learning
    Rupal Kakkar Jan 5, 2021
    1,319  Views
    Introduction to Set & Map in Salesforce || What is Set || What is Map ||

    Introduction to Set & Map in Salesforce || What is Set || What is Map ||

    Video in Others

    From Salesforce instructor, Become a Salesforce Expert. A brief introduction about what is a Set, map, and what are their importance? Check out the video to…

    Salesforce Expert, Set, Salesforce Map, Map
    Neha Yadav Oct 21, 2019
    2,145  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.