function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Anthony CicconeAnthony Ciccone 

rest api join query

I am trying to write an inner join and noticed from some other threads you need to write it similar to this 

services/data/v47.0/query/?q=SELECT+Id,Name,(select+OpportunityId,Price+From+OpportunityLineItem) +From+Opportunity+Where+Opportunity.Id+=+OpportunityLineItem.OpportunityId

this returns a MALFORMED_QUERY errorCode. Is this query possible if so what would be the correct way to write this. 

Thanks in advance
Maharajan CMaharajan C
Hi Anthony,

Try to append the OpportunityLineItem.OpportunityId  inside the single quotes. Because when am trying the below query it's working fine:

Below ways are working but am hardcoding the id here:

/services/data/v47.0/query/?q=SELECT+Id,name,(select+Name+From+Contacts)+from+Account+where+Id+=+%270012800000hB97aAAC%27

/services/data/v47.0/query/?q=SELECT+Id,name,(select+Name+From+Contacts)+from+Account+where+Id+=+'0012800000hB97aAAC'


https://salesforce.stackexchange.com/questions/79570/escaping-in-salesforce-rest-query


Thanks,
Maharajan.C