You need to sign in to do that
Don't have an account?
gagan batra
I want to get all the items associated with an sales order using SOQL ,
I tried with this SELECT Id, Name, (SELECT Name FROM Sales_Order__c ) FROM Sales_Order_Line_Item__c but not working
SELECT Id, Name, Sales_Order__r.Name FROM Sales_Order_Line_Item__c
The inner query is used for retrieving child records but you are trying to access the parent record.In order to access fields of parent you need to follow this approach :
For querying parent fields : PARENT_OBJECT_FIELD_NAME__r.FIELD_NAME : Sales_Order__r.Name
For querying child records : Use inner query : (SELECT Id FROM CHILD_RELATIONSHIP_NAME__r)
Cheers!!!
Actully i need all sales order with its all line items created today.
How can I achive this.
The query would be :
[SELECT Id, (SELECT Id FROM SALES_ORDER__r {the Child relation ship Name + '__r' } WHERE CREATEDDATE = TODAY) FROM Sales_Order__c WHERE CREATEDDATE = TODAY]
Try to map the query with this : [select Id ,(Select Id from Contacts ) from Account]
This would help you understand.
Cheers!!!