Tim Nelson <[EMAIL PROTECTED]> writes:
> I am getting division by zero on a calculated field ( sum(sales) is 0 )
> and I can't find a way around this. I figured out you can't use an
> aggregate in a where, and using having the parser must (obviously)
> evaluate the select fields before consider
Richard Huxton wrote:
Tim Nelson wrote:
I am getting division by zero on a calculated field ( sum(sales) is 0 )
It's a two-stage process, so you'll want a sub-query. Something like: ...
Thanks. That's a cool addition to my bag of tricks.
---(end of broadcast)-
Tim Nelson <[EMAIL PROTECTED]> schrieb:
> I am getting division by zero on a calculated field ( sum(sales) is 0 ) and
> I can't find a way around this. I figured out you can't use an aggregate
> in a where, and using having the parser must (obviously) evaluate the
> select fields before consid
Tim Nelson <[EMAIL PROTECTED]> writes:
> I am getting division by zero on a calculated field ( sum(sales) is
> 0 ) and I can't find a way around this. I figured out you can't use
> an aggregate in a where, and using having the parser must
> (obviously) evaluate the select fields before considerin
On Oct 19, 2005, at 21:26 , Tim Nelson wrote:
I am getting division by zero on a calculated field ( sum(sales) is
0 ) and I can't find a way around this. I figured out you can't
use an aggregate in a where, and using having the parser must
(obviously) evaluate the select fields before con
Tim Nelson wrote:
I am getting division by zero on a calculated field ( sum(sales) is 0 )
It's a two-stage process, so you'll want a sub-query. Something like:
SELECT
type,
tot_sales,
tot_cost
((tot_sales * tot_cost / tot_sales) * 100) AS percent
FROM
(
SELECT
type, sum(sales) AS tot
On 10/19/05 8:26 AM, "Tim Nelson" <[EMAIL PROTECTED]> wrote:
> I am getting division by zero on a calculated field ( sum(sales) is 0 )
> and I can't find a way around this. I figured out you can't use an
> aggregate in a where, and using having the parser must (obviously)
> evaluate the select fi
36 18
---
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Tim Nelson
Sent: mercredi 19 octobre 2005 14:27
To: pgsql-general@postgresql.org
Subject: [GENERAL] getting around---division by zero on numeric
I am getting division by zero on a calculated
I am getting division by zero on a calculated field ( sum(sales) is 0 )
and I can't find a way around this. I figured out you can't use an
aggregate in a where, and using having the parser must (obviously)
evaluate the select fields before considering teh having clause.
Does anyone have a way