Problem description:
The following SOQL query:
[SELECT Id, ParentId, NormalizedScore, Channel
FROM FAQ__VoteStat
WHERE ParentId IN : knowledgeArticleIDs AND Channel =: channelName
ORDER BY NormalizedScore desc
LIMIT 5];
Returning results in unexpected way, for example: If I have 3 articles with the following NormalizedScore:
Article 1: 0
Article 2: 0
Article 3: 3
I received the result order as follow:
Article 1: 0
Article 2: 0
Article 3: 3
When I was expecting to receive the following order:
Article 3: 3
Article 1: 0
Article 2: 0
Solution help needed:
I don't understand why the Order By Desc not working, it's seems weird. I know I can sort the articles manually from code, but that seems redundant, maybe there is something I missed regarding the NormalizedScore field, which can explain why the order by is not working properly.
Thank in advanced!