pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Bret Stern <bret_stern@machinemanagement.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Sort question - Fractions, Metric etc
Date: Sat, 14 Aug 2021 09:46:30 -0700
Message-ID: <0310c35b-10b1-83a2-4efc-7e569a634001@aklaver.com> (raw)
In-Reply-To: <40fa1830-71d0-c908-ba5e-5c72cfbe9368@machinemanagement.com>
References: <57f60e61-114f-c403-b2e2-820e76f08d64@machinemanagement.com>
	<24d005b3-47a4-3f78-450e-d394b9e47d6f@aklaver.com>
	<40fa1830-71d0-c908-ba5e-5c72cfbe9368@machinemanagement.com>

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
>>>
>>>
>>>
>>
>>


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (20+ messages)  latest in thread

Message-ID: <0310c35b-10b1-83a2-4efc-7e569a634001@aklaver.com>
Permalink:  ../0310c35b-10b1-83a2-4efc-7e569a634001@aklaver.com/
Also on:    postgresql.org/message-id/0310c35b-10b1-83a2-4efc-7e569a634001@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, bret_stern@machinemanagement.com
  Subject: Re: Sort question - Fractions, Metric etc
  In-Reply-To: <0310c35b-10b1-83a2-4efc-7e569a634001@aklaver.com>
  References: <57f60e61-114f-c403-b2e2-820e76f08d64@machinemanagement.com> <24d005b3-47a4-3f78-450e-d394b9e47d6f@aklaver.com> <40fa1830-71d0-c908-ba5e-5c72cfbe9368@machinemanagement.com> <0310c35b-10b1-83a2-4efc-7e569a634001@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox