Forum Discussion

discipline_lr's avatar
discipline_lr
Contributor
7 years ago

Problem with order messages by metrics.views

Hi!

Recently I found that sorting in my component doesn't work properly.

I'm trying to get sorted messages using this query:

SELECT id, metrics FROM messages ORDER BY metrics.views DESC LIMIT 3

 

The result:

    "items" : [ {
      "type" : "message",
      "id" : "162",
      "metrics" : {
        "type" : "message_metrics",
        "views" : 117
      }
    }, {
      "type" : "message",
      "id" : "141",
      "metrics" : {
        "type" : "message_metrics",
        "views" : 121
      }
    }, {
      "type" : "message",
      "id" : "140",
      "metrics" : {
        "type" : "message_metrics",
        "views" : 98
      }
    } ]

Any idea what the problem might be?

 

 

Thanks.