Duplicate counting

From: Jiří Němec <konference(at)menea(dot)cz>
To: pgsql-general(at)postgresql(dot)org
Subject: Duplicate counting
Date: 2005-01-20 13:29:29
Message-ID: 967171848.20050120142929@menea.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello all,

I wrote a function which counts price of product from retail price and
discount. It works. But I need to count price with tax of same
product. The best way is to use counted price and add only a tax. I
would like to do by this way:

SELECT count_price(retail, discount) AS price, count_price_tax(price,
tax) FROM foo.

But PostgreSQL reports that "price" column doesn't exist. It doesn't
exist, but is counted by first calling "count_price()" function.

Is there some way how I shouldn't count these prices twice and use
just counted price?

--
Jiří Němec, ICQ: 114651500
www.menea.cz - www stránky a aplikace

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Lavoie 2005-01-20 13:38:56 Re: Debian Sarge, Postgres 7.4.6 + PAM
Previous Message Tom Lane 2005-01-20 13:14:08 Re: Unique Index