Re: Sort question - Fractions, Metric etc

From: Bret Stern <bret_stern(at)machinemanagement(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Sort question - Fractions, Metric etc
Date: 2021-08-14 16:57:34
Message-ID: e579027b-02a9-8712-ea84-6ccd7c2d11fd@machinemanagement.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I like that idea

On 8/14/2021 9:46 AM, Adrian Klaver wrote:
> On 8/14/21 9:37 AM, Bret Stern wrote:
>> Strings;
>>
>> I haven't explored doing this with numeric types, but some columns
>> needed alpha chars eg 13mm.
>
> Two columns:
>
> data_val(numeric)    data_unit(varchar)
> 13            mm
>
>>
>> Although I could have front ended this UI with mm nomenclature I did
>> not.
>>
>> I'll put a table together with appropriate numeric types and see if
>> the sort will behave.
>
> It will.
>
>>
>>
>>
>> On 8/14/2021 9:21 AM, Adrian Klaver wrote:
>>> On 8/14/21 9:14 AM, 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)
>>>
>>> Alright how is this different from metric or fraction?
>>>
>>> I can sort of see fraction if you mean as 1/3, 1/20, etc.
>>>
>>> What is the data type of the field you are storing this in?
>>>
>>>>
>>>> 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
>>>>
>>>>
>>>>
>>>
>>>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2021-08-14 17:03:02 Re: Sort question - Fractions, Metric etc
Previous Message Adrian Klaver 2021-08-14 16:46:30 Re: Sort question - Fractions, Metric etc