I am using the Work orders and cases from SFDC. In my js, i have established a relation that work order "belongs to" cases. Then in my PHP file i am making the query using equi join case id as the foreign key in work orders to retrive the case number. But on sfdc side , in work orders the look up has been mentioned on the case id and not on the case number. the query fails and i am not able to fetch the required data.
This is my query. And the Work Looks ups to case i.e One case can have multiple work orders.
SELECT Id, FS_Account_Name__c, FS_Asset_Number__c, FS_Case_Number__c,
Name, FS_Comment__c,FS_Defect_Type__c,FS_Description__c, WO_Status__c,CaseNumber
from FS_Work_Order__c,Case
where FS_Work_Order__c.FS_Case_Number__c = Case.Id
LIMIT 100
SOQL does not support joins with multiple objects in the FROM clause. Instead, you'll want to traverse the object relationships from either the parent or the child. Take a look at the API Doc about Relationship Queries. I'm making a guess of your relationship names (they can be found in the describeSObject() results), but the queries should look something like this:
Parent Relationship Query
SELECT FS_Case_Number__r.Id,
FS_Case_Number__r.FS_Account_Name__c,
FS_Case_Number__r.FS_Asset_Number__c,
FS_Case_Number__r.FS_Case_Number__c,
FS_Case_Number__r.Name,
FS_Case_Number__r.FS_Comment__c,
FS_Case_Number__r.FS_Defect_Type__c,
FS_Case_Number__r.FS_Description__c,
WO_Status__c,
FS_Case_Number__r.CaseNumber
FROM FS_Work_Order__c
Child Relationship Query
SELECT Id,
FS_Account_Name__c,
FS_Asset_Number__c,
FS_Case_Number__c,
Name,
FS_Comment__c,
FS_Defect_Type__c,
FS_Description__c,
(SELECT WO_Status__c FROM FS_Work_Order__r),
CaseNumber
FROM Case