Understanding Query Results
Query results are returned as nested objects. The primary or “driving” object of the main SELECT statement in a SOQL query contains query results of subqueries.
For example, you can construct a query using either parent-to-child or child-to-parent syntax:
-
Child-to-parent:
This query returns one query result (assuming there were not too many returned records), with a row for every contact that met the
WHEREclause criteria. -
Parent-to-child:
This query returns a set of accounts, and within each account, a query result set of Contact fields containing the contact information from the subquery.
The following sample illustrates how to process subquery results: