On Tuesday, January 16, 2024, Maiquel Grassi <gra...@hotmail.com.br> wrote:

> Hello David, how are you?
>
> Firstly, I apologize if I wasn't clear in what I intended to propose. I
> used a very specific example here, and it wasn't very clear what I really
> wanted to bring up for discussion.
>
> I understand that it's possible to order the "returned dataset" using
> "order by ... desc."
>
>
It is, but it is also possible to order a window frame/partition by
specifying order by in the over clause.  Which is what I showed, and what
you should try to use.  That orders the enumeration, you can still order,
or not, the output dataset.



> I don't have a base column to use for "order by," and I also can't use
> CTID column.
>

Then you really don’t have an ordering in the data itself.  This is unusual
and not really worth adding a new function to deal with.


>
> How can I do this without using my reversed enumeration "row_number desc"
> function?
>

Count() over() - row_number() over()

 Please don’t top-post replies, in-line and trim like I’m doing.

David J.

P.s. if you really don’t care about logical order you probably should just
let your front-end deal with it.

Reply via email to