From: | Alexey M Boltenkov <padrebolt(at)yandex(dot)ru> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Gavan Schneider <list(dot)pg(dot)gavan(at)pendari(dot)org> |
Cc: | Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>, Sbob <sbob(at)quadratum-braccas(dot)com> |
Subject: | Re: sort output per alpha-numeric? |
Date: | 2021-12-02 05:40:09 |
Message-ID: | b9488ae2-54a9-9411-c09d-b5916803211b@yandex.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
On 12/02/21 02:55, David G. Johnston wrote:
> On Wed, Dec 1, 2021 at 4:35 PM Gavan Schneider
> <list(dot)pg(dot)gavan(at)pendari(dot)org <mailto:list(dot)pg(dot)gavan(at)pendari(dot)org>> wrote:
>
> On 2 Dec 2021, at 9:50, David G. Johnston wrote:
>
> On Wed, Dec 1, 2021 at 3:38 PM Sbob
> <sbob(at)quadratum-braccas(dot)com
> <mailto:sbob(at)quadratum-braccas(dot)com>> wrote:
>
> I want the displayed print\_size to be ordered by size
> (8x10, then 11x14, etc)
>
> Is there an easy way to do this?
>
> You can sort by an expression. For the data as shown the
> following should
>
>
> A little more heavy handed might be to convert the two numbers
> into a single integer for ranking, e.g.,
>
> Good idea, but "replace(print_size, 'x', '0')::integer" seems like a
> simpler implementation - though I'd want to double-check some
> single-digit scenarios before making a final choice (if there are any
> besides "8" to worry about).
>
> David J.
>
Natural sort may be less invasive.
order by length(print_size), print_size
From | Date | Subject | |
---|---|---|---|
Next Message | Rui DeSousa | 2021-12-02 06:03:02 | Re: sort output per alpha-numeric? |
Previous Message | Gavan Schneider | 2021-12-02 00:51:35 | Re: sort output per alpha-numeric? |