From: | Vijay Deval <deval(at)giaspn01(dot)vsnl(dot)net(dot)in> |
---|---|
To: | Rob <rob(at)obsidian(dot)co(dot)za> |
Cc: | PostgreSQL Server <postgres(at)obsidian(dot)co(dot)za>, pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Tricky query |
Date: | 2002-05-04 13:05:40 |
Message-ID: | 3CD3DCA4.28B285CD@giaspn01.vsnl.net.in |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Simple sum of two queries
1) value/1.14 WHERE vatInclusive is true
2)value WHERE vatInclusive is false
should give the correct answer.
Rob wrote:
> Hi all
>
> I want to calculate the value of my stock holdings, which is simply
> latest_stock_count.stock_count * products.cost_price. I have the
> following query which does this
>
> SELECT p.barcode, (l.stock_count * p.cost_price) AS value
> FROM latest_stock_count AS l NATURAL JOIN products AS p
> WHERE l.barcode = p.barcode;
>
> The problem is that I always want the cost_price excluding sales tax
> (known as VAT - which is 14%). So if vatInclusive is true, what I
> actually want is cost_price/1.14, not cost_price.
>
> --
> Rob
>
From | Date | Subject | |
---|---|---|---|
Next Message | Joel Burton | 2002-05-04 13:52:11 | Re: Tricky query |
Previous Message | Oliver Elphick | 2002-05-03 23:13:26 | Re: Date Formatting |