简体   繁体   中英

How to Select from two tables in 1 query in Salesforce SOQL iOS

How can i combine this two request in salesforce SOQL query into 1 single request in 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];

and

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];

使用此子查询:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM