Link Search Menu Expand Document

Sorting

Table of contents
  1. Sorting
    1. Using  ORDER BY

There is no default sorting for the SQL based queries, if you want to have a order you need to specify it.

Using  ORDER BY

Syntax:

ORDER BY expression1 [ASC|DESC], ...

You can specify order with keywords:

  • ASC - ascending (by default)
  • DESC - descending

The expression can be any of the columns available to you.

This example returns all the completed tasks ordering by due date and then done date.

 WHERE status->indicator = 'x'
 ORDER BY dueDate DESC, doneDate DESC
WHERE status->indicator = 'x'
ORDER BY dueDate DESC, doneDate DESC