Received: from localhost (uranus.hub.org [200.46.204.60]) by postgresql.org (Postfix) with ESMTP id 5E7329FA1DB for ; Mon, 13 Nov 2006 10:29:41 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.60]) (amavisd-new, port 10024) with ESMTP id 70510-02 for ; Mon, 13 Nov 2006 10:29:38 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.170]) by postgresql.org (Postfix) with ESMTP id 2A3A69FA17D for ; Mon, 13 Nov 2006 10:29:37 -0400 (AST) Received: by ug-out-1314.google.com with SMTP id k3so913755ugf for ; Mon, 13 Nov 2006 06:29:36 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=KMP2lbS6d7sagXZBvcEONWTRwb+IfB7Vgs+UAP3ESRviobz03Qkxq+xme1HTev1/7nKH9hCRs51QcQOeGiqWn8h2kJv6C4hMe1LonUETtMzeHvRvMrPVigaVracyqLybDQsXKHXo5ierdZT2mjTkOVLgzhDfpOUjT5M0dRNtCGg= Received: by 10.82.129.5 with SMTP id b5mr231207bud.1163428149966; Mon, 13 Nov 2006 06:29:09 -0800 (PST) Received: by 10.82.161.3 with HTTP; Mon, 13 Nov 2006 06:29:09 -0800 (PST) Message-ID: <1f30b80c0611130629v4616365cr50c8fd99f01fce3a@mail.gmail.com> Date: Mon, 13 Nov 2006 19:29:09 +0500 From: imad To: "A. Kretschmer" Subject: Re: max (timestamp,timestamp) Cc: pgsql-sql@postgresql.org In-Reply-To: <20061113140828.GD14281@a-kretschmer.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <45587718.2010009@numerixtechnology.de> <20061113140828.GD14281@a-kretschmer.de> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/129 X-Sequence-Number: 26781 max (timestamptz, timestamptz) does not exist already. You need to create a simple function in PLpgSQL something like if a > b return a; else return b; Even an sql function will do the job here using case statement. --Imad www.EntepriseDB.com On 11/13/06, A. Kretschmer wrote: > am Mon, dem 13.11.2006, um 13:46:00 +0000 mailte T E Schmitz folgendes: > > I tried the following query but the query fails as > > "function max (timestamp w. timezone,timestamp w. timezone) does not exist" > > > > SELECT id, > > > > MAX(last_updated, > > (SELECT MAX (last_updated) FROM product_category_member WHERE > > product_category_member.id = product_category.id)) > > > > FROM product_category > > > > > > product_category.last_updated and product_category_member.last_updated > > are timestamps with timezone. > > Really, there are no such function. Perhaps this can help you: > > SELECT id, MAX(product_category.last_updated), > MAX(product_category_member.last_updated) from product_category, > product_category_member WHERE product_category_member.id = > product_category.id; > > **untested** > > > > Your fault is that there are no max(timestamp,timestamp) - funktion and > i think, you should read more about JOINs. > > > Andreas > -- > Andreas Kretschmer > Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header) > GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend >