Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pXqlN-00082B-Fp for pgsql-general@arkaria.postgresql.org; Thu, 02 Mar 2023 21:46:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pXqlM-0001RB-5t for pgsql-general@arkaria.postgresql.org; Thu, 02 Mar 2023 21:46:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pXqlL-0001R1-Rk for pgsql-general@lists.postgresql.org; Thu, 02 Mar 2023 21:46:55 +0000 Received: from mail-qt1-x830.google.com ([2607:f8b0:4864:20::830]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pXqlJ-0002re-B0 for pgsql-general@lists.postgresql.org; Thu, 02 Mar 2023 21:46:55 +0000 Received: by mail-qt1-x830.google.com with SMTP id h19so867357qtk.7 for ; Thu, 02 Mar 2023 13:46:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677793612; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=oh59tNmvnbBIMd0pbqb/YF3BaEM5gxIQN0hTtms51J4=; b=AxmG791ZJ1GWwNtUZ5XNe9HV4AIXebL6BAELnbdnofR3CXjTdMk5p+COI+X4AwlobX 0ElayvuGn+szBjXP14rlkRIILKual/rKd583WAIUaZBwCqLgb5tNBQBUkKXQtRenqnNl 9hdcwhxspDD1fQu4v9fkb9jfV6Xk06dLKH5fFtm4FKrWhs7/YjVsdxVNC3arUC1/H+pQ tIdQoLqLuur6Xgw5Q7TObe6H45HDvbs3fAAFydgkzYRN5zt3GEh1DsO0GfX2zz6N4T7f Je4RI6Q3u+rSBzaQ8NEgO9ICK7QdW/A3IoticC2lUrcd490PLAZNmaXU+swWyg78Vol6 hntw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677793612; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=oh59tNmvnbBIMd0pbqb/YF3BaEM5gxIQN0hTtms51J4=; b=Lm/loP33dbH7r6KmLklJ2AHPqsmgc3vayXuiCTfys2QLkEKGP3u1HEJ9i+O282Okuj 4OmOci3P3nNsBbApZAd5WCGpneonpyyiccWTrISzY52KJCAGkInlhrdki9top7zgpWLe hJnFgyUXFZ3iM8/vDxPMHjBPuVZohj0bcC3t53W2dgwFZysyGPrmE1qMvGgItJIu6WFU 1jt8tGECV+PV0qZhYSB4dvxqM3LVyzHML/VyM8THGbjYrUxpy+gayxsg6+Ec3sbMUmDP RFXcMkkOPcsMzlmXHe8epW/F1oijcwDOYL74MjtBHoYXjjlTQQqjMmYcgygQ1nY2UFEu WNlQ== X-Gm-Message-State: AO0yUKUkXFSh/NSiDTXQb2rdU6G3wNBb5323qCTNk7g1/Glygis6rIWH gYUF1qqsB8KuSGAvcaSIZNY= X-Google-Smtp-Source: AK7set843X3R1nNLLBFDv+quOvrcmk1qkPQWj+RSgA1OrEGMko26/nn9YH+DwfJIlMQwHaoQTgoQgw== X-Received: by 2002:a05:622a:1042:b0:3bf:a997:f6e1 with SMTP id f2-20020a05622a104200b003bfa997f6e1mr6550631qte.23.1677793611822; Thu, 02 Mar 2023 13:46:51 -0800 (PST) Received: from ?IPV6:2600:1700:bd2c:b810::43? ([2600:1700:bd2c:b810::43]) by smtp.googlemail.com with ESMTPSA id o5-20020a374105000000b007429ee9482dsm376694qka.134.2023.03.02.13.46.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Mar 2023 13:46:51 -0800 (PST) Content-Type: multipart/alternative; boundary="------------wkTSmQKH0MecPe0OFRrf02ui" Message-ID: Date: Thu, 2 Mar 2023 15:46:51 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: Converting row elements into a arrays? Content-Language: en-US To: "David G. Johnston" Cc: pgsql-general@lists.postgresql.org References: <788ab733-d0d1-7791-fb22-7c2724b08816@gmail.com> From: Ron In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------wkTSmQKH0MecPe0OFRrf02ui Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 3/2/23 15:34, David G. Johnston wrote: > On Thu, Mar 2, 2023 at 1:58 PM Ron wrote: > > Postgresql 12.13 > > Given the sample below, I'm looking for how to generate this output.  > It's > like GROUP BY, but generating an array instead of an aggreate number. > > > Group By creates groups, that's it.  How you aggregate the data that are > in those groups is determined by which function you call.  Sure, a > function like "count()" produces a single number, but there are other > functions.  Even a whole documentation section listing them. > > https://www.postgresql.org/docs/current/functions-aggregate.html > > David J. > I'm used to the bog standard COUNT, AVG, MIN, MAX, SUM. It didn't occur to me that there would be others... -- Born in Arizona, moved to Babylonia. --------------wkTSmQKH0MecPe0OFRrf02ui Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit On 3/2/23 15:34, David G. Johnston wrote:
On Thu, Mar 2, 2023 at 1:58 PM Ron <ronljohnsonjr@gmail.com> wrote:
Postgresql 12.13

Given the sample below, I'm looking for how to generate this output.  It's
like GROUP BY, but generating an array instead of an aggreate number.


Group By creates groups, that's it.  How you aggregate the data that are in those groups is determined by which function you call.  Sure, a function like "count()" produces a single number, but there are other functions.  Even a whole documentation section listing them.


David J.


I'm used to the bog standard COUNT, AVG, MIN, MAX, SUM. It didn't occur to me that there would be others...

--
Born in Arizona, moved to Babylonia.
--------------wkTSmQKH0MecPe0OFRrf02ui--