public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andreas Joseph Krogh <[email protected]>
To: [email protected]
Subject: ORDER BY elements in ARRAY
Date: Tue, 27 Aug 2024 13:22:49 +0200 (CEST)
Message-ID: <VisenaEmail.11.efc8bf0cbc6c75fa.1919390a6d7@origo-test01.app.internal.visena.net> (raw)



Hi, I have this query:


SELECT comp.entity_id as company_id, comp.companyname AS company_name , ARRAY( 
SELECT (pers.entity_id , pers.firstname , pers.lastname )::PersonTypeTest FROM 
onp_crm_person AS pers WHERE pers.relation_id = comp.entity_id ) as 
person_array FROM onp_crm_relation comp ORDER BY person_array ;


And I'd like to ORDER BY (conceptually) lower(pers.firstname), 
lower(pers.lastname). I realize there might be more than 1 person in the array, 
so I'd like to order by “firstname and lastname of first element, the same for 
second etc.”



Any way to do this?






--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
[email protected] <mailto:[email protected]>
www.visena.com <https://www.visena.com;
 <https://www.visena.com;

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: ORDER BY elements in ARRAY
  In-Reply-To: <VisenaEmail.11.efc8bf0cbc6c75fa.1919390a6d7@origo-test01.app.internal.visena.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox