Salesforce REST API SOQL 获取商机帐户

Salesforce REST API SOQL get account for opportunies

我想查询我的所有机会(或联系人或其他),然后加入帐户,这样我就可以获得姓名等。我能够让它工作,查询帐户并加入机会,但反之则不然。

select Name, Id, (select Id, Name, CloseDate, StageName, Amount from Opportunities where ownerId = 'id') from Account

有没有办法改为查询机会?我不想获取所有帐户并循环获取机会数据。应该是一个简单的属于类型关系。

我试过这样的查询:

select Id, Name, CloseDate, StageName, Amount, (select Name, Id from Account) from Opportunity where ownerId = 'id'

但这给了我 "Didn't understand relationship 'Account' in FROM part of query call."

谢谢!

对于子->父关系,您只需使用指向所需字段的虚线路径,例如

Select id, Amount, CloseDate, Account.Name from Opportunity