0

I am using Symfony2.7 with Doctrine. My query is working without doing the sum of the relevance in the ORDER BY section.

What is wrong? Is Doctrine not supporting a sum?

SELECT s.shopArticleId as article_id, 
   MATCH (s.soundex, s.categorySoundex) AGAINST ('T200') AS relevance1,
   MATCH (s.soundex, s.categorySoundex) AGAINST ('A530') AS relevance2

FROM FrontendMainBundle:Search s 

WHERE MATCH (s.soundex, s.categorySoundex) AGAINST ('T200') > 0 
AND MATCH (s.soundex, s.categorySoundex) AGAINST ('A530') > 0 

ORDER BY (relevance1 + relevance2) DESC; 
craphunter
  • 921
  • 2
  • 10
  • 29
  • Yes, Doctrine allows `SimpleArithmeticExpression` in `ORDER BY` clausule. – yceruto Sep 23 '16 at 14:31
  • Possible duplicate of [MySQL match() against() - order by relevance and column?](http://stackoverflow.com/questions/6259647/mysql-match-against-order-by-relevance-and-column) – yceruto Sep 23 '16 at 14:32

0 Answers0