• Sudiptaa Ghosh
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies

Can somebody pls tell how to do MINUS  in SOQL queries: 

Like in SQL:

SELECT supplier_id, supplier_name FROM suppliers WHERE supplier_id > 2000 MINUS SELECT company_id, company_name FROM companies WHERE company_id > 1000 ORDER BY 2;

SELECT Id, (SELECT Name from Contacts WHERE CreatedDate > YESTERDAY or LastModifiedDate >  YESTERDAY) from Account where CreatedDate > YESTERDAY or LastModifiedDate > YESTERDAY

I want to get all records from Account and Contact where created date or last modified date is within a certain range. If there are changes in Contact , I want those records , even there are no changes in Account Object 

But this query will not fetch any records if there are any change in only Contact and no change in Account. How can I possibly do that.

Can anybody please help.

 

SELECT Id, (SELECT Name from Contacts WHERE CreatedDate > YESTERDAY or LastModifiedDate >  YESTERDAY) from Account where CreatedDate > YESTERDAY or LastModifiedDate > YESTERDAY

I want to get all records from Account and Contact where created date or last modified date is within a certain range. If there are changes in Contact , I want those records , even there are no changes in Account Object 

But this query will not fetch any records if there are any change in only Contact and no change in Account. How can I possibly do that.

Can anybody please help.