| From: | Tobias Bußmann <e(dot)t(dot)bussmann(at)ing(dot)twinwave(dot)net> |
|---|---|
| To: | "WIESECKE Bernd" <BWiesecke(dot)gre(at)gauff(dot)com>, <pgsql-de-allgemein(at)postgresql(dot)org> |
| Subject: | Re: Aggregatfunktion First |
| Date: | 2006-01-30 11:55:54 |
| Message-ID: | 0d1801c62594$289d68f0$2383fea9@LaptopTB |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-de-allgemein |
Hi Bernd,
einmal 'first' aus meiner Repository:
CREATE FUNCTION agg_first (state anyelement, value anyelement) RETURNS
anyelement
AS '
BEGIN
IF (state IS NULL) THEN
RETURN value;
ELSE
RETURN state;
END IF;
END;
'
LANGUAGE plpgsql IMMUTABLE;
CREATE AGGREGATE "first" (
BASETYPE = anyelement,
SFUNC = agg_first,
STYPE = anyelement
);
hth
Tobias
WIESECKE Bernd <BWiesecke(dot)gre(at)gauff(dot)com> wrote:
> Gibt es eigentlich eine "First" Funktion in PG für die Aggregation.
> Bekomme immer die Meldung unbekannt.
> Brauche aber aus jeder in "Group By..." definierten Gruppe die Werte
> mehrerer Felder eines DS in dem der Max.Wert gefunden wurde. Wollte
> also sortieren,gruppieren und den 1.DS jeder Gruppe verwenden.
> Eine Idee wäre hilfreich
>
>
>
> Mit freundlichen Grüßen
>
> Bernd Wiesecke
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that
> your message can get through to the mailing list cleanly
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Christoph Lamprecht | 2006-01-30 13:44:26 | Re: Aggregatfunktion First |
| Previous Message | A. Kretschmer | 2006-01-30 11:43:50 | Re: Aggregatfunktion First |