From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Peter Atkins <Peter(dot)Atkins(at)nextcard(dot)com> |
Cc: | "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: type conversion? |
Date: | 2002-04-09 17:48:09 |
Message-ID: | 20020409104600.H95735-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Tue, 9 Apr 2002, Peter Atkins wrote:
> I have a column "total_hours | character varying(5) " and I am unable to
> perform the aggrigate function SUM() because of the column type.
> Without changing the type is there a way to convert the datatype by using
> CAST(), to_char() or something simular? So that I may calculate the SUM().
>
> SELECT SUM(total_hours) AS hours FROM my_table WHERE flag='$flag';
I think this may work:
SELECT SUM(to_number(total_hours, '99999')) from my_table where ...
From | Date | Subject | |
---|---|---|---|
Next Message | Jean-Luc Lachance | 2002-04-09 17:51:09 | Re: type conversion? |
Previous Message | Peter Atkins | 2002-04-09 17:08:31 | type conversion? |