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

    What is Salesforce Digital Engagement in 2024?

    Blog in Others

    What is Digital Engagement? Salesforce Digital Engagement is a customer service product that helps companies communicate with customers via messaging apps, webchats, in-app chats, and…

    Boost Customer Satisfaction, Customer Service, Digital Engagement, Einstein Bots, email-to-case
    Vimera | Andersen Jan 4, 2024
    2,330  Views
    Salesforce Duplicate Management

    Salesforce Duplicate Management Became Easier

    Blog in Others, Salesforce Products

    Peeklogic Smart Duplicate Manager. Salesforce Duplicate Management Became Easier Peeklogic helps to provide configure, modernize, and customize solutions for the Salesforce business. Peeklogic uses development…

    AppExchange App, AppExchange Application, AppExchange Application Use, Application Works, Auto Deduct Functionality
    Sergii Grushai Dec 31, 2020
    2,709  Views

    Salesforce Lookup Relationship and Salesforce Master-Detail Relationship: An Overview

    Blog in Others

    The relationship is used to connect different Objects within org. Salesforce provides the following types of relationships : Lookup relationship Master-Detail relationship Self-relationship External lookup…

    Child Record, Junction Object, Lookup Relationships, Master Detail Fields, Objects
    Shweta Feb 20, 2020
    15,007  Views

    Popular Salesforce Videos

    Creating an Approval Process in Salesforce with Example

    Creating an Approval Process in Salesforce with Example

    Video in Salesforce Implementation

    Approval Process in Salesforce is an automated process that automates how Salesforce records are approved in your org. Approval Process in Salesforce is a combination…

    Salesforce Administration, Salesforce1, Salesforce Records, Email Templates, Salesforce Fields
    Pooja Apr 3, 2018
    3,191  Views
    Introduction to Salesforce Orchestrator

    Introduction to Salesforce Orchestrator

    Video in Salesforce Training, Salesforce Workflow

    Flow Orchestrator was created so admins like you can quickly create sophisticated multi-user, multi-step automated business processes with clicks, not code. Experienced Salesforce Admins will…

    Salesforce Training, Salesforce Tutorial, salesforce, User Experience, Salesforce Admins
    Prafull Oct 19, 2021
    3,900  Views
    How to Become a Certified Salesforce Admin

    How to Become a Certified Salesforce Admin

    Video in Salesforce Certifications

    It is predicted there will be 1.9m new Salesforce job openings by 2020. Consultants thinking of a career in IT should consider training in cloud…

    Salesforce Certifications, Salesforce Reports, Salesforce Jobs, Salesforce Administrator, Salesforce Data Management
    Abhay Jan 11, 2018
    1,800  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.