You need to sign in to do that
Don't have an account?
Iceman123
soql help: Is there a way to include a child object in a where clause?
SELECT Name, (SELECT lastname FROM Contacts WHERE CreatedBy.Alias = 'x') FROM Account
Take the above example, is there a way (in SOQL only) to only return Account rows where the child relationship subquery ((SELECT lastname FROM Contacts WHERE CreatedBy.Alias = 'x')) is not empty (ie. contains at least 1 child object row)?
thanks
Pi
You can add a semi-join to the outer query to do this, e.g.
select name, (select lastname from contacts where createdBy.Alias='x') from account where id in (select accountId from contact where createdby.alias='x')
All Answers
You can add a semi-join to the outer query to do this, e.g.
select name, (select lastname from contacts where createdBy.Alias='x') from account where id in (select accountId from contact where createdby.alias='x')
cool thx!