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

Andreas Kretschmer <[email protected]>
Newsgroups gmane.comp.db.postgresql.german
Message-ID <20120721144721.GA18564@tux>
Mag. Dr. Stefan Krejci <[email protected]> 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°

-- 
Sent via pgsql-de-allgemein mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-de-allgemein
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.