文章标题出现在KnowledgeArticleVersion表中,而ViewArtized Score出现在KnowledgeArticleViewStat表中。两个表的父级是KnowledgeArticle,但我无法将其加入KnowledgeArticleVersion,因为DB模式中不存在关系名称。因为,我可以先执行这样的查询
Select k.ParentId, k.NormalizedScore From KnowledgeArticleViewStat k order by k.NormalizedScore
然后
SELECT Title, UrlName, KnowledgeArticleId FROM KnowledgeArticleVersion WHERE PublishStatus='Online' AND language ='en_US' and KnowledgeArticleId in (:ids)
但是我的宗教禁止我执行两个查询而不是一个查询。
也许有人可以告诉我在SOQL中执行连接的正确方法。
答案 0 :(得分:0)
假设你使用k.parentIds:ids,这将起作用:
SELECT id,Title , UrlName, KnowledgeArticleId, PublishStatus, language
FROM KnowledgeArticleVersion
WHERE PublishStatus='Online'
AND language ='en_US'
AND KnowledgeArticleId IN (SELECT ParentId
FROM KnowledgeArticleViewStat
)