Forum Discussion

ronaksomani's avatar
10 years ago

How to show highest Kudos posts using API2?

Hi, I want to show most active posts based on either number of kudos or views. I found a way to implement based on number of replies. But could not find similar approach for kudos/views.  For repli...
  • VarunGrazitti's avatar
    10 years ago

    ronaksomani - You can do it either way,

     

    Based on the number of Kudos:

    SELECT * FROM messages WHERE kudos.sum(weight)>0 AND depth = 0 ORDER BY kudos.sum(weight) DESC Based on the number of views:
    SELECT * FROM messages WHERE depth = 0 ORDER BY metrics.views DESC