Forum Discussion

realtordotcom's avatar
realtordotcom
Contributor
8 years ago

Sorting based on replies count, giving wrong result.

Am trying to sort posts based on replies count, but we are getting wrong result from the query.

 

Please find below query which am using for sorting.

 

select * from messages where depth = 0 ORDER BY replies.count(*) DESC

 

Please suggest anything am doing wrong or wrong query am using.

 

Results returned from API

 

15 replies

14 replies

12 replies

10 replies

8 replies

9 replies

4 replies

 

 

There is a jumbled between  5th  and 6th response as mentioned in above response.

    • realtordotcom's avatar
      realtordotcom
      Contributor

       

      Since there are so many posts without reply am not able to find if it is properly working in ascending order or not.

       

      But according to my requirement i need to show most replied post in DESC order, where LIQL query not giving response count in proper order.

       

      Some where in the middle replies count mismatch order returning from below LIQLquery.

       

      select * from messages where depth = 0 ORDER BY replies.count(*) DESC