Salesforce Fact #590 | SOQL semi-join & anti-join

What are semi-join and anti-join in SOQL?

A semi-join is a subquery on another object in an IN clause to restrict the records returned.

example: SELECT Id, Name FROM Account WHERE Id IN (SELECT AccountId FROM Opportunity WHERE IsClosed=true)

An anti-join is a subquery on another object in an NOT IN clause to restrict the records returned.

example: SELECT Id, Name FROM Account WHERE Id NOT IN (SELECT AccountId FROM Opportunity WHERE IsClosed=true)

Comments

Popular posts from this blog

Salesforce Fact #192 | Call batch apex from flow

Salesforce Fact #457 | Get current user role name in flow