API v2 _ Problem with ORDER BY
Hi,
I wanted to play a little with LiQL requests and tried to execute this request I found in the API v2 documentation:
SELECT id, topics.count(*), messages.count(*), views FROM boards ORDER BY views DESC
But I get this error:
{ "status" : "error", "message" : "invalid query syntax for SELECT id,topics.count(*),messages.count(*),views FROM boards ORDER BY views DESC", "data" : { "type" : "error_data", "code" : 604, "developer_message" : "Field 'views' does not exist for object 'boards'. in: SELECT id,topics.count(*),messages.count(*),views FROM boards ORDER BY views DESC", "more_info" : "" }, "metadata" : { } }
I also tried to switch views for id which should be a valid field but I still get the error when using ORDER BY (field 'id' does not exist):
SELECT id, topics.count(*), messages.count(*) FROM boards ORDER BY id DESC
Any idea what the problem might be?
Thanks.
The top of the document mentioned that the features are added in 15.1. Make sure your community have upgraded to 15.1.
But for the use case mentioned, you should be able to do something like this in previous versions:
SELECT * FROM messages where category.id = '<category>' and depth=0 ORDER BY post_time DESC
Hope this helps.