Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 3DB24635298 for ; Thu, 2 Jul 2009 11:48:54 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 66600-03 for ; Thu, 2 Jul 2009 11:48:43 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f209.google.com (mail-fx0-f209.google.com [209.85.220.209]) by mail.postgresql.org (Postfix) with ESMTP id A34AE6352BF for ; Thu, 2 Jul 2009 11:48:52 -0300 (ADT) Received: by fxm5 with SMTP id 5so642068fxm.19 for ; Thu, 02 Jul 2009 07:48:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=od1Nmiu0ODxeiVX4nVhXe4b1l7DrYoVikFBgPKpKF6U=; b=J3otmqbC66PwaB0d0QV+oMtgGXsny2KOsz/e/2c3TSvEddRmIR7f4KTtxjWmqsrT8E SOhyDYWe61WEQ4xEHTkLxbhF3a5Y++X849Z2U5OvIKSGoh9El6Y0eYZb5nYBWffyms0X GtWBngpghO6GXTDcUpolOe4Rwm1er5e0+3mtU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=OCnkh7YcQVh+fTbcnhvjlmJ+/15pqZQaGNdlBlUza/497bfmKHTMTSDpMxJCehjhpj X+n9pyKU/XYVUXPbheJsXL3khLt3odQ1sUC+Iqbs2NmJf4iaWfGLDmEJo2LoknRyDQ0y Nb5PvdB5QMy8h7dI7DfCR0HBX5z35lPNvQfp0= MIME-Version: 1.0 Received: by 10.86.74.4 with SMTP id w4mr260496fga.65.1246546130524; Thu, 02 Jul 2009 07:48:50 -0700 (PDT) Date: Thu, 2 Jul 2009 16:48:50 +0200 Message-ID: Subject: Create custom aggregate function and custom sfunc From: Jasmin Dizdarevic To: pgsql-sql@postgresql.org Content-Type: multipart/alternative; boundary=000e0cd28e9c4e5f62046dba2395 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200907/10 X-Sequence-Number: 32751 --000e0cd28e9c4e5f62046dba2395 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit hi, i have to create a aggregate function which evaluates a maximum text value but with some conditions i have to take care of. is there a way to access a value set of each group? e.g.: customer ; seg 111 ; L1 111 ; L2 111 ; L1 222 ; L3 222 ; L3 222 ; L2 the result should look like this: 111: L1 - because L1 is higher than L2 and ratio of L1 : L2 is 2 : 1 222: L3 - because L3 is higher than L2 and ratio of L3 : L2 is 2 : 1 i hope you know what i mean. ty --000e0cd28e9c4e5f62046dba2395 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
=A0hi,
=A0
i have to create a aggregate function which evaluates a maximum text v= alue=A0but with some conditions i have to take care of.
is there a way to access a value set of each group?
e.g.:
=A0
customer ; seg
111 ; L1
111 ; L2
111 ; L1
222 ; L3
222 ; L3
222 ; L2
=A0
the result should look like this:
=A0
111: L1 - because L1 is higher than L2 and ratio of L1 : L2 is 2 : 1
222: L3 - because L3 is higher than L2 and ratio of L3 : L2 is=A02 : 1=
=A0
i hope you know what i mean.
=A0
ty
=A0
=A0
--000e0cd28e9c4e5f62046dba2395--