From: | imad <immaad(at)gmail(dot)com> |
---|---|
To: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: max (timestamp,timestamp) |
Date: | 2006-11-13 14:29:09 |
Message-ID: | 1f30b80c0611130629v4616365cr50c8fd99f01fce3a@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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 <andreas(dot)kretschmer(at)schollglas(dot)com> 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
>
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2006-11-13 15:06:43 | Re: max (timestamp,timestamp) |
Previous Message | imad | 2006-11-13 14:09:34 | Re: Inserting data in composite types! |