Re: sort output per alpha-numeric?

Поиск
Список
Период
Сортировка
От Gavan Schneider
Тема Re: sort output per alpha-numeric?
Дата
Msg-id 1BB3B402-0456-4685-B633-86ECA5328892@pendari.org
обсуждение исходный текст
Ответ на Re: sort output per alpha-numeric?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-admin
On 2 Dec 2021, at 10:55, David G. Johnston wrote:

> 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).
>
This piqued my interest and confirmed several sizes in the single digit (inch) category are considered standard:
https://pikwizard.com/blog/standard-photo-sizes/

This isn’t too big a deal provided the sizes end up in the order the OP wants so the more elegant substituting of  ‘x’
willgenerate the correct order as far as I can tell from superficial inspection. 

In my own (more pedestrian) way I would have these sizes as their own table with ranking as a column (i.e., calculate
onceand store), and use that table to enforce a foreign key constraint to prevent any rogue sizes getting into the
customerrelevant tables. Then the ranking number is totally arbitrary. Of course good practice is to allow 10, or more,
betweennumbers because there is always that something which comes along later.  The job is small enough that is can be
donequicker by hand. 

Gavan Schneider
——
Gavan Schneider, Sodwalls, NSW, Australia
Explanations exist; they have existed for all time; there is always a well-known solution to every human problem —
neat,plausible, and wrong. 
— H. L. Mencken, 1920



В списке pgsql-admin по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: sort output per alpha-numeric?
Следующее
От: Alexey M Boltenkov
Дата:
Сообщение: Re: sort output per alpha-numeric?