[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-sql
Subject:    Re: [SQL] Join or Where?
From:       Richard Huxton <dev () archonet ! com>
Date:       2003-06-26 13:09:01
[Download RAW message or body]

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

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic