Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 401DA9FA22A for ; Mon, 13 Nov 2006 10:08:36 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 16883-02 for ; Mon, 13 Nov 2006 10:08:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.177]) by postgresql.org (Postfix) with ESMTP id 774059FA1DB for ; Mon, 13 Nov 2006 10:08:32 -0400 (AST) Received: from [194.25.154.138] (helo=webserv.wug.de) by mrelayeu.kundenserver.de (node=mrelayeu2) with ESMTP (Nemesis), id 0MKwtQ-1GjcU91zAW-0007ST; Mon, 13 Nov 2006 15:08:30 +0100 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1GjcU8-0006fD-00 for pgsql-sql@postgresql.org; Mon, 13 Nov 2006 15:08:28 +0100 Date: Mon, 13 Nov 2006 15:08:28 +0100 From: "A. Kretschmer" To: pgsql-sql@postgresql.org Subject: Re: max (timestamp,timestamp) Message-ID: <20061113140828.GD14281@a-kretschmer.de> References: <45587718.2010009@numerixtechnology.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45587718.2010009@numerixtechnology.de> X-OS: Debian/GNU Linux - weil ich es mir Wert bin! X-Message-Flag: "Windows" is not the answer. "Windows" is the question and the answer is "no"! User-Agent: Mutt/1.5.9i X-Provags-ID: kundenserver.de abuse@kundenserver.de login:51ea9561fc3f6d9539a2acd743e4748c X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/127 X-Sequence-Number: 26779 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