From: Jean-Luc Lachance <jllachan@nsd.ca>
To: Peter Atkins <Peter.Atkins@nextcard.com>
Cc: 'pgsql-sql@postgresql.org' <pgsql-sql@postgresql.org>
Subject: Re: type conversion?
Date: Tue, 09 Apr 2002 13:51:09 -0400
Message-ID: <3CB32A0D.D02958A6@nsd.ca> (raw)
References: <02E689F991FFD311A75D009027B6A73E0886EAC7@corp_mail01.sf.nextcard.com>
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@postgresql.org
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jllachan@nsd.ca, Peter.Atkins@nextcard.com
Subject: Re: type conversion?
In-Reply-To: <3CB32A0D.D02958A6@nsd.ca>
* 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