Re: [SQL] max (timestamp,timestamp)

2006-11-14 Thread T E Schmitz
Michael Fuhr wrote: On Mon, Nov 13, 2006 at 07:29:09PM +0500, imad wrote: 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; Since PostgreSQL 8.1 you can use GREATEST: test= SELECT

[SQL] max (timestamp,timestamp)

2006-11-13 Thread T E Schmitz
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

Re: [SQL] max (timestamp,timestamp)

2006-11-13 Thread A. Kretschmer
am Mon, dem 13.11.2006, um 13:46:00 + 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

Re: [SQL] max (timestamp,timestamp)

2006-11-13 Thread imad
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 [EMAIL PROTECTED]

Re: [SQL] max (timestamp,timestamp)

2006-11-13 Thread Michael Fuhr
On Mon, Nov 13, 2006 at 07:29:09PM +0500, imad wrote: 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; Since PostgreSQL 8.1 you can use GREATEST: test= SELECT greatest(1, 2); greatest