Re: Mehrere Einträge anhand Primary-Key-Liste löschen

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-de-allgemein(at)postgresql(dot)org
Subject: Re: Mehrere Einträge anhand Primary-Key-Liste löschen
Date: 2012-07-21 14:47:21
Message-ID: 20120721144721.GA18564@tux
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-de-allgemein

Mag. Dr. Stefan Krejci <office(at)skrejci(dot)com> wrote:

Damit willst das aktuelle Alter bestimmen, oder?

>   WHERE ((((EXTRACT(YEAR FROM CURRENT_DATE)) - (EXTRACT(YEAR FROM l."LGebDat"))
> -
>
>           (EXTRACT(DOY FROM CURRENT_DATE)<EXTRACT(DOY FROM
> l."LGebDat"))::integer) >= 6) AND

geht übersichtlicher und einfacher so:

test=*# select extract(year from age('2007-07-28'::date));
date_part
-----------
4
(1 row)

Das '2007-07-28'::date ist das fragliche Datum, Geburtstag.

Welche PG-Version ist am Start? Mit 9.1 könnte man wCTE verwenden für
Deine eigentliche Abfrage, aber Du hast ja auch so schon passende
Antworten.

Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknown)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°

In response to

Browse pgsql-de-allgemein by date

  From Date Subject
Next Message Mag. Dr. Stefan Krejci 2012-07-21 15:31:47 AW: [pgsql-de-allgemein] Mehrere Einträge anhand Primary-Key-Liste löschen
Previous Message Susanne Ebrecht 2012-07-21 14:20:25 Re: Mehrere Einträge anhand Primary-Key-Liste löschen