1

Article title is present in KnowledgeArticleVersion table and View Normalized Score is present in KnowledgeArticleViewStat table. The parent of both tables is KnowledgeArticle, but I can't join it to KnowledgeArticleVersion, because there is no relation name present in DB schema. Of cos, I can at first execute such query

Select k.ParentId, k.NormalizedScore From KnowledgeArticleViewStat k order by k.NormalizedScore 

Then

SELECT Title, UrlName, KnowledgeArticleId FROM KnowledgeArticleVersion WHERE PublishStatus='Online' AND language ='en_US' and KnowledgeArticleId in (:ids)

But my religion forbids me from executing two queries instead of one.

Maybe someone can tell me the right way to perform join in SOQL.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
user1570815
  • 178
  • 3
  • 9

1 Answers1

0

Assuming the k.parentIds is what you use in :ids this would work:

SELECT id,Title , UrlName, KnowledgeArticleId, PublishStatus, language 
FROM KnowledgeArticleVersion 
WHERE PublishStatus='Online'
AND language ='en_US' 
AND KnowledgeArticleId  IN (SELECT ParentId
                            FROM KnowledgeArticleViewStat
                           )
Samuel DR
  • 1,215
  • 14
  • 28