Re: type conversion?

From: Jean-Luc Lachance <jllachan(at)nsd(dot)ca>
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:51:09
Message-ID: 3CB32A0D.D02958A6@nsd.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Try:

SELECT SUM(int4(total_hours)) AS hours FROM my_table WHERE flag='$flag';

JLL

Peter Atkins wrote:
>
> All,
>
> 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';
>
> Thanks!
> -p
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Teter 2002-04-09 19:48:16 Yes! Thank you!
Previous Message Stephan Szabo 2002-04-09 17:48:09 Re: type conversion?