From: | Guido Piazzi <gpiazzi(at)nemo(dot)it> |
---|---|
To: | Chris Johnson <cmj(at)inline-design(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: [SQL] Absolute value on int2 or int4 field |
Date: | 1998-08-28 08:52:14 |
Message-ID: | Pine.LNX.3.96.980828104441.130B-100000@ik2gdx.ampr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Thu, 27 Aug 1998, Chris Johnson wrote:
> I need to sort a list of entries by the absolute value of a particular
> field. I examined the documentation and found that @ is the operator that
> I need, but it doesn't appear to work on int2 or int4 fields.
>
> Anyone have any ideas on how to accomplish this?
guido=> select @a::float as abs from test order by abs;
abs
---
1
2
(2 rows)
I run 6.3.1 on Linux 2.0.27. BTW, trying to insert -2 into float
fields without casting didn't work on my box!
Regards, Guido
--------------------------------------------
Guido Carlo Piazzi gpiazzi(at)nemo(dot)it
Non coronabitur nisi qui legitime certaverit
From | Date | Subject | |
---|---|---|---|
Next Message | Shawn T. Walker | 1998-08-28 18:17:31 | Contertine timespan to hours |
Previous Message | Walt Bigelow | 1998-08-28 03:06:16 | Re: [SQL] copy one to many? |