Salesforce soql通过连接对象获取数据

Salesforce soql通过连接对象获取数据,salesforce,apex-code,Salesforce,Apex Code,我有以下三个自定义对象: 订单c Design_uu_c(具有对顺序的查找和对位置的查找,因此Design ojbect是连接对象) 地点 在订单页面布局上,我想添加一个包含VF页面的空白部分,以便显示订单所有设计记录的位置记录 一个订单可以有许多设计,一个设计可以有许多位置。我需要一种方式来分组和显示订单上VF页面中的每个设计/位置 如何构建此查询并在VF页面上显示结果 我正在尝试这样一个查询:选择Location\u r.Name,Location\u r.Mockup From Desig

我有以下三个自定义对象:

订单c

Design_uu_c(具有对顺序的查找和对位置的查找,因此Design ojbect是连接对象)

地点

在订单页面布局上,我想添加一个包含VF页面的空白部分,以便显示订单所有设计记录的位置记录

一个订单可以有许多设计,一个设计可以有许多位置。我需要一种方式来分组和显示订单上VF页面中的每个设计/位置

如何构建此查询并在VF页面上显示结果

我正在尝试这样一个查询:选择Location\u r.Name,Location\u r.Mockup From Design\u c,其中Order\u c='xxxxxxxxxxxxx'

此外,除了在相关列表中显示VF页面部分外,还有更好的方法显示结果吗

谢谢你的帮助


问候。

第一件事,第一件事。由于设计通过查找与其他两个对象相关,因此它不是连接对象。仅当连接对象的两个父对象与子对象具有主-详细信息关系时,连接对象才可用

我认为你想要实现的是遍历一个父子关系。您将需要在最后一半使用子查询。从文档中,您可以看到:

Query **child-to-parent relationships**, which are often many-to-one. Specify these relationships directly in the SELECT, FROM, or WHERE clauses using the dot (.) operator.
For example:
SELECT Id, Name, Account.Name
FROM Contact 
WHERE Account.Industry = 'media'
This query returns the ID and name for only the contacts whose related account industry is media, and for each contact returned, the account name.




 Query **parent-to-child**, which are almost always one-to-many. Specify these relationships using a subquery (enclosed in parentheses), where the initial member of the FROM clause in the subquery is related to the initial member of the outer query FROM clause. Note that for subqueries, you should specify the plural name of the object as that is the name of the relationship for each object.
For example:
SELECT Name,
  (
    SELECT LastName
    FROM Contacts
  )
FROM Account
The query returns the name for all the accounts, and for each account, the last name of each contact.