Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id C69769FBB4E; Mon, 18 Jun 2007 13:50:52 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 05579-08; Mon, 18 Jun 2007 13:50:48 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mtao05.charter.net (mtao05.charter.net [209.225.8.179]) by postgresql.org (Postfix) with ESMTP id 955789FBB3C; Mon, 18 Jun 2007 13:50:48 -0300 (ADT) Received: from aa02.charter.net ([10.20.200.154]) by mtao05.charter.net (InterMail vM.7.08.02.00 201-2186-121-20061213) with ESMTP id <20070618165047.OPVS10967.mtao05.charter.net@aa02.charter.net>; Mon, 18 Jun 2007 12:50:47 -0400 Received: from [10.0.1.2] (really [66.188.164.45]) by aa02.charter.net with ESMTP id <20070618165047.EFSQ15491.aa02.charter.net@[10.0.1.2]>; Mon, 18 Jun 2007 12:50:47 -0400 In-Reply-To: <4676B38A.303@terra.com.br> References: <467697ED.8030506@terra.com.br> <108B61B7-DB9A-4FE3-832C-323866956DFE@seespotcode.net> <7DA5333D-3437-4033-A222-128E541A04C2@seespotcode.net> <4676B38A.303@terra.com.br> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <2D977EAC-654B-44F5-AB1F-336031F6466D@seespotcode.net> Cc: postgresql sql list , pgsql-general Content-Transfer-Encoding: 7bit From: Michael Glaesemann Subject: Re: [SQL] Setting Variable - (Correct) Date: Mon, 18 Jun 2007 11:50:46 -0500 To: Ranieri Mazili X-Mailer: Apple Mail (2.752.2) X-Chzlrs: 0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/1063 X-Sequence-Number: 115886 [Please reply to the list so that others may benefit from and participate in the discussion.] On Jun 18, 2007, at 11:32 , Ranieri Mazili wrote: > Thanks a lot for your prompt reply. > You query is perfect for my problem, but I need another thing with > it, I need to return the sum of production_hours of each month of > the current year, and I need to return too the average of the 3 > past years, can I do all in only one query or I need to do a UNION > with another query? Glad you found it helpful. What have you tried so far? Michael Glaesemann grzm seespotcode net