Help with lua live query

Greetings - please forgive the new guy for what may be a too simple a question (of which I have many) but why is the result of the following not resulting in a sorted table? Perhaps I am thinking too SQL old-school...

${query[[
from o = index.tag "project"
order by o.ref asc
select {Page="[[".. o.ref .."]]", Task=o.title}
]]}

...if I should have asked this question elsewhere then please educate me :slight_smile:

Not an expert, but for me locally (with silverbullet 2.4.1) the 'asc' keyword in the 'order by' is not allowed, while 'desc' is.
I think that the query logic has been updated in silverbullet 2.5, so if you like me have a slightly older version then the more recent documentation might not be correct for you.

If that is not the case, could you describe a bit what you are seeing. Do you get an error or is in an empty table?

The query produces a list of items with #project tag and "order by o.ref asc" with or without "asc" or "desc" makes no difference. In fact the whole line can be omitted with no effect.
I am running 2.5.2.

Please, tell us what exactly are you trying to achieve?

Your query works just fine for me on version 2.5.2, both with asc and desc, it sorts as expected.

However, you should realize it sorts on the 'full path' of your notes, not just on the page title. If you use folders, this might impact the sort order. If you add key = o.ref, you can check if this quickly.

Thanks folks. All helpful feedback. And watching some of Zef's videos helped.

I am tagging things I want to do on a date with a tag that looks like #-0326, implying do this on 25-Mar. Simple but effective. A quick tag edit and the task is rescheduled ... whether item, task, para, page, etc.

${query[[from o=index.tag "-0325" select {Link="[["..o.ref.."]]",Path=o.ref} order by string.upper(o.ref)]]}