Re: Join or Where? - Mailing list pgsql-sql

From Richard Huxton
Subject Re: Join or Where?
Date
Msg-id 200306261409.01688.dev@archonet.com
Whole thread Raw
In response to Join or Where?  (Együd Csaba <csegyud@freemail.hu>)
List pgsql-sql
On Thursday 26 Jun 2003 12:21 pm, Együd Csaba wrote:
> Urgent Help : Use of return from function/procedure.Hi,
> could anybody tell me what can be the difference between these queries?
> There are a big difference but I can't understand the reasons. For some
> reasons the firs query calculates getup column in a wrong way. It allways
> devides with 10. (???) While the getupquantity column comes well.
>
> With the second query everything is ok.

1 > select (select getupquantity from t_products where id=productid) as
2 > getupquantity,
3 >        quantity,
4 >        (select quantity/getupquantity) as getup
5 > from t_stockchanges, t_products
6 > where (getupquantity<>0)
7 > limit 30;

I don't think the t_products in the first line is the same as that in the
fifth line - that'd surely mess up your values.

--  Richard Huxton


pgsql-sql by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: Change the behaviour of the SERIAL "Type"
Next
From: Bruce Young
Date:
Subject: contrib/tsearch - chopped words?