如何从Salesforce SOQL iOS中的1个查询中的两个表中进行选择

时间:2014-10-17 09:40:03

标签: ios salesforce soql

如何将salesforce SOQL查询中的这两个请求合并为iOS中的单个请求:

NSString *theRequest = [NSString stringWithFormat:@"SELECT Name, OpportunityID FROM OpportunityLineItem where OpportunityID = '%@'", [companyDic objectForKey:@"Id"]];
SFRestRequest *request = [[SFRestAPI sharedInstance] requestForQuery:theRequest];
[[SFRestAPI sharedInstance] send:request delegate:self];

NSString *theRequest2 = [NSString stringWithFormat:@"SELECT CompetitorName FROM OpportunityCompetitor where OpportunityID = '%@'", [companyDic objectForKey:@"Id"]];
SFRestRequest *request2 = [[SFRestAPI sharedInstance] requestForQuery:theRequest2];
[[SFRestAPI sharedInstance] send:request2 delegate:self];

1 个答案:

答案 0 :(得分:0)

使用此子查询:

SELECT Name, OpportunityID FROM OpportunityLineItem where OpportunityID IN (SELECT OpportunityID FROM OpportunityCompetitor where OpportunityID = '%@')