Re: sort output per alpha-numeric? - Mailing list pgsql-admin

From David G. Johnston
Subject Re: sort output per alpha-numeric?
Date
Msg-id CAKFQuwb3n6gvEPB_w=RuV3kW2QmNXoEOqH7yyumJatj6aSAtwA@mail.gmail.com
Whole thread Raw
In response to Re: sort output per alpha-numeric?  (Gavan Schneider <list.pg.gavan@pendari.org>)
Responses Re: sort output per alpha-numeric?
Re: sort output per alpha-numeric?
List pgsql-admin
On Wed, Dec 1, 2021 at 4:35 PM Gavan Schneider <list.pg.gavan@pendari.org> wrote:

On 2 Dec 2021, at 9:50, David G. Johnston wrote:

On Wed, Dec 1, 2021 at 3:38 PM Sbob <sbob@quadratum-braccas.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.

pgsql-admin by date:

Previous
From: Gavan Schneider
Date:
Subject: Re: sort output per alpha-numeric?
Next
From: Gavan Schneider
Date:
Subject: Re: sort output per alpha-numeric?