Re: Sort question - Fractions, Metric etc

Поиск
Список
Период
Сортировка
От Gogala, Mladen
Тема Re: Sort question - Fractions, Metric etc
Дата
Msg-id 702e71c6-5091-9c65-87c0-e4599dddd376@gmail.com
обсуждение исходный текст
Ответ на Sort question - Fractions, Metric etc  (Bret Stern <bret_stern@machinemanagement.com>)
Ответы Re: Sort question - Fractions, Metric etc  (Guyren Howe <guyren@gmail.com>)
Re: Sort question - Fractions, Metric etc  (Bret Stern <bret_stern@machinemanagement.com>)
Список pgsql-general
I would write a stable function converting everything to metric (or 
imperial, depends on your preferences) and sort on the return of the 
function. Since unit conversion functions do not need to modify the 
database and should always return the same values for the same 
arguments, the function can be used within a query (that is the meaning 
of the keyword "STABLE")  and you can use it for sorting stuff

Regards

On 8/14/2021 12:14 PM, Bret Stern wrote:
> I have a table with metric, imperial, fraction columns.
>
> Is there a way to sort correctly using imperial (eg; .125, .375, .437 
> -> 1., 1.125)
>
> Couldn't handle it with ORDER BY ASC, DESC args so I added a 
> sort_column and sorted based
>
> on those values eg; 1,2,3,4,5,6 indicating the value I need to show in 
> which sequence.
>
>
> Just curious what the pro's do
>
> Bret
>
>
-- 
Mladen Gogala
Oracle DBA
Tel: (347) 321-1217
Blog: https://dbwhisperer.wordpress.com



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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Understaning postgresql instance vs database
Следующее
От: Guyren Howe
Дата:
Сообщение: Re: Sort question - Fractions, Metric etc