Αποτελέσματα Αναζήτησης
The following REST API call against the /query endpoint executes a nested SOQL query that traverses the Account → Contacts → Assets → WorkOrders → WorkOrderLineItems parent/child relationships.
- Using Relationship Queries
Using Relationship Queries. Use SOQL to query several...
- Using Relationship Queries
Using Relationship Queries. Use SOQL to query several relationship types. Query Child-to-Parent Relationships. Query child-to-parent relationships, which are often many-to-one, using the dot (.) operator. Specify these relationships directly in the SELECT, FROM, or WHERE clauses. SELECT Id, Name, Account.Name. FROM Contact .
You can do this by following the relationship in the query, e.g. select accountId, account.Name, id from contact order by accountId There are more examples in the SOQL docs
It cane be done like the following: [SELECT ID, Name, Field1 from Object__c WHERE Id IN ( SELECT Id FROM Object2__c WHERE Field2 = 'SomeValue')] However, with the junction object you don't actually need to use a nested query.
The safe way to deal with subquery results is a nested loop. The outer loop iterates over the parent object, and the inner loop iterates over the related child records. You can then increment a counter there (in the inner loop).
soql SELECT Id, Name, CreatedDate, (SELECT Name FROM Status_History__r ORDER BY CreatedDate DESC LIMIT 1) FROM Service_Order__c WHERE id IN (SELECT id FROM Status_History__r WHERE Name = 'Order Completed')
25 Ιουν 2013 · If you’re doing a SOQL query on Account, you use a nested query IE SELECT Name, (SELECT Order_Field_1__c FROM Order_Headers__r) FROM Account Note two things: 1.