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 › SOQL to find Accounts without Contacts AND Opportunities in Salesforce

    Tagged: Account, Dynamic SOQL, Salesforce Customization, SOQL

    • Salesforce® Discussions

      SOQL to find Accounts without Contacts AND Opportunities in Salesforce

      Posted by Radhakrishna on August 21, 2017 at 4:05 AM

      I am looking for help to run a Join Query to find all out Accounts in our Database without Contacts AND Opportuntiy. I can run the query indepetly, but I would like to join the queries.

      The Query I am runing to find Accounts without Contacts: Select Id, Name From Account Where Id NOT IN (SELECT AccountId FROM Contacts)
      Query to find Accounts without Opportunties: Select Id, Name From Account Where Id NOT IN (SELECT AccountId FROM Opportunity)

      Shaharyar replied 9 years, 1 month ago 2 Members · 1 Reply
      • Account
      • Dynamic SOQL
      • Salesforce Customization
      • SOQL
    • 1 Reply
    • Shaharyar

      Member
      August 21, 2017 at 5:37 AM

      Hi Radakrishna,

      Use this

      Select Id, Name from Account where ID NOT IN (Select AccountId from Contact) AND ID NOT IN (Select AccountId from Opportunity)

    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 Knowledge Rest API

    Unboxing Salesforce Knowledge Rest APIs

    Blog in Salesforce integration

    SF knowledge rest APIs come in 4 different flavours (Types) based on the polymorphic nature of the data model and each different type (as below)…

    API, API Actions, API Operations, Articles Details, Articles List
    Mohit Aug 29, 2022
    3,559  Views

    Salesforce Integration with OpenAI : Revolutionizing Image Generation

    Blog in Salesforce integration

    Hey Guys, today we are discussing DALL-E (which is a product of openAI) and Salesforce Integration (Salesforce Integration with OpenAI). DALL·E is designed to generate coherent…

    AuraEnabled, AuraResponse, Authorization, Bearer Token, Benefits
    Kizzy Consulting Sep 15, 2023
    1,933  Views
    Use of Database.Statefull in Batch Apex

    Use of Database.Statefull in Batch Apex when aggregating values for large data

    Blog in Others

    We often came across situations in apex where we are required to calculate aggregate data but we have a limitation of 50000 records at a…

    Batch Apex, database.stateful, Salesforce batch Class, Salesforce Data Management, Salesforce Objects
    Rachit May 10, 2016
    8,665  Views

    Popular Salesforce Videos

    3 Tips on How To Deliver a Successful Product Launch | Salesforce on Salesforce

    3 Tips on How To Deliver a Successful Product Launch | Salesforce on Salesforce

    Video in Salesforce Products

    Salesforce defines a product launch as announcing a new offering to the public. Launches are an opportunity to tell a compelling story about your product,…

    Salesforce Training, salesforce, Salesforce Video, sales, Salesforce Learning
    Nauman May 27, 2022
    2,117  Views
    Salesforce Financial Services Cloud Implementation Guide

    Salesforce Financial Services Cloud Implementation Guide

    Video in Salesforce Cloud Platform, Salesforce Implementation

    You’ve decided to use Salesforce Financial Services Cloud but where do you begin? How can you utilize Salesforce to track all your customer interactions and…

    Salesforce Training, Salesforce Development, Salesforce Integration, Salesforce Consulting, Salesforce Video
    DB Aug 31, 2023
    1,618  Views
    How relationship works in Salesforce?

    How relationship works in Salesforce?

    Video in Salesforce Development

    In this video, following things have been explained: How to create relationships in Salesforce? What is the need of relationship between two objects in Salesforce?…

    Salesforce Data, Many to Many Relationship, Salesforce Object Relationships, Salesforce Relationships
    Prafull Nov 1, 2018
    2,493  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.