Can SOQL handle subqueries? For example, to get the row counts of both current and deleted rows in a table..

  (SELECT COUNT(id) FROM SNF___c WHERE IsDeleted = False) is_deleted, 
  (SELECT COUNT(id) FROM SNF___c WHERE IsDeleted = True) is_current

When I execute this in SSIS / TaskFactory SalesForce.Com Source component I receive the error message in the below image:

enter image description here

1 Answer 1


Subqueries are possible but they are not aliasable nor can you select anything that isn't a "child" object of the main object you are selecting. Example right from the documentation:

SELECT Account.Name, (SELECT Contact.LastName FROM Account.Contacts)
FROM Account
  • Okay. In that case I'll run these as separate queries, and merge the results.
    – Jim Horn
    Commented Jan 15, 2015 at 21:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .