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 1lNFSk-0005sL-O1 for pgsql-general@arkaria.postgresql.org; Fri, 19 Mar 2021 13:46:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lNFSj-0006ID-J5 for pgsql-general@arkaria.postgresql.org; Fri, 19 Mar 2021 13:46:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lNDau-0004kl-TP for pgsql-general@lists.postgresql.org; Fri, 19 Mar 2021 11:47:08 +0000 Received: from mail.netnea.com ([82.220.26.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lNDas-0001Uc-9Z for pgsql-general@lists.postgresql.org; Fri, 19 Mar 2021 11:47:07 +0000 X-Virus-Scanned: Debian amavisd-new at Subject: Re: postgresql order lowercase before uppercase To: basti , pgsql-general@lists.postgresql.org References: <5a174fad-c30d-6d65-38c8-a3d9af8377df@unix-solution.de> <34c739c1-b930-d58a-521b-c4a7b236d9bd@unix-solution.de> From: Christian Ramseyer Message-ID: <82d22fc5-73a4-19dc-f927-b32dc9caacf5@netnea.com> Date: Fri, 19 Mar 2021 12:47:02 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 19.03.21 10:12, basti wrote: > On 19.03.21 08:33, Laurenz Albe wrote: >> On Thu, 2021-03-18 at 23:51 +0100, basti wrote: >>> Am 18.03.21 um 17:19 schrieb Laurenz Albe: >>>> On Thu, 2021-03-18 at 15:39 +0100, basti wrote: >>>>> I need to as follow: >>>>> >>>>> ande >>>>> Amma >>>>> Anit >>>>> Anti >>>>> Brac >>>>> Cali >>>>> .... >>>> Laurenz' approach is sound, it just needs a little tweak to not trip up on the "andere Marken" uppercase M. Try this: select id, marke.name from marke ORDER BY left(marke.name,1) <> left(lower(marke.name),1), marke.name Fiddle: http://sqlfiddle.com/#!17/d9d83e/9 Cheers Christian -- Christian Ramseyer, netnea ag Network Management. Security. OpenSource. https://www.netnea.com