X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 5973630FE7C for ; Thu, 26 Jun 2003 14:00:05 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 56834-05 for ; Thu, 26 Jun 2003 10:59:54 -0300 (ADT) Received: from anchor-post-33.mail.demon.net (anchor-post-33.mail.demon.net [194.217.242.91]) by svr1.postgresql.org (Postfix) with ESMTP id B1F1A30FEA1 for ; Thu, 26 Jun 2003 10:59:53 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-33.mail.demon.net with esmtp (Exim 3.35 #1) id 19VXI1-000H6z-0X; Thu, 26 Jun 2003 14:59:53 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id C9C7D177FC; Thu, 26 Jun 2003 14:09:04 +0100 (BST) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id 32D32163BD; Thu, 26 Jun 2003 14:09:04 +0100 (BST) Content-Type: text/plain; charset="iso-8859-1" From: Richard Huxton Organization: Archonet Ltd To: =?iso-8859-1?q?Egy=FCd=20Csaba?= , pgsql-sql@postgresql.org Subject: Re: Join or Where? Date: Thu, 26 Jun 2003 14:09:01 +0100 User-Agent: KMail/1.4.3 References: <003301c33bd5$198f7250$230a0a0a@compaq> In-Reply-To: <003301c33bd5$198f7250$230a0a0a@compaq> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200306261409.01688.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Archive-Number: 200306/296 X-Sequence-Number: 14054 On Thursday 26 Jun 2003 12:21 pm, Egy=FCd 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=3Dproductid) 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= =20 fifth line - that'd surely mess up your values. --=20 Richard Huxton