You need to sign in to do that
Don't have an account?
Aron Schor
Help with a SOQL query (Sales order / order detail relationship)
I am having problems with this query, which I believe to be similar to the second basic one.
SELECT Order_Value__C
( SELECT Warehouse__C FROM Order_Detail__C ) FROM Order_header__c
I assume the relationship here is the same?
SELECT Id, Name, Industry, AnnualRevenue,
( SELECT Name, Email, BirthDate FROM Contacts ) FROM Account
It says
MALFORMED_QUERY:
( SELECT Warehouse__C FROM Order_Detail__C
^ ERROR at Row:2:Column:6
unexpected token: 'SELECT'
In our System API Name Order_Details__c show
Field Label Order Header
API NAME Order_Header__c
Data Type Master-Detail(Sales Order)
I assume the relationship would be the same and it would work?
Individually both of these work
This works SELECT Order_Value__C FROM Order_header__c
This works SELECT Warehouse__C FROM ORDER_Detail__C
SELECT Order_Value__C
( SELECT Warehouse__C FROM Order_Detail__C ) FROM Order_header__c
I assume the relationship here is the same?
SELECT Id, Name, Industry, AnnualRevenue,
( SELECT Name, Email, BirthDate FROM Contacts ) FROM Account
It says
MALFORMED_QUERY:
( SELECT Warehouse__C FROM Order_Detail__C
^ ERROR at Row:2:Column:6
unexpected token: 'SELECT'
In our System API Name Order_Details__c show
Field Label Order Header
API NAME Order_Header__c
Data Type Master-Detail(Sales Order)
I assume the relationship would be the same and it would work?
Individually both of these work
This works SELECT Order_Value__C FROM Order_header__c
This works SELECT Warehouse__C FROM ORDER_Detail__C
Your query retrieves all records from Order_header__c where ORDER_Date__C between 2 dates and Warehouse__C FROM Order_Detail__r if one or more Order_Detail__r are joined with Order_header__c.
I suppose you want select Order_header__c only when Order_Detail__r have Warehouse__C = '57'.
This one should give you the result you want (I hope so): Fred
All Answers
Missing "," after Order_Value__C
Try this Hope this helps,
Fred
SELECT Order_Value__C,
( SELECT Warehouse__C FROM Order_Detail__C ) FROM Order_header__c
Ok, its semi working! However, not all the results are warehouse 57. Any idea why?
SELECT customer_Name__C, customer_Number__C, Purchase_order__C, NAME, Order_Value__C, Order_Date__c,
( SELECT Warehouse__C FROM Order_Detail__r WHERE Warehouse__C = '57' ) FROM Order_header__c
WHERE ORDER_Date__C > 2014-12-02 AND Order_Date__C < 2014-12-10
Here is a partial screen shot and some are for a different warehouse.
Thanks.
Your query retrieves all records from Order_header__c where ORDER_Date__C between 2 dates and Warehouse__C FROM Order_Detail__r if one or more Order_Detail__r are joined with Order_header__c.
I suppose you want select Order_header__c only when Order_Detail__r have Warehouse__C = '57'.
This one should give you the result you want (I hope so): Fred