pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: basti <mailinglist@unix-solution.de>
To: pgsql-general@lists.postgresql.org
Subject: Re: postgresql order lowercase before uppercase
Date: Fri, 19 Mar 2021 16:58:55 +0100
Message-ID: <fe4c460dc7e6dc3201a4cfa0893dca2e04143987.camel@cybertec.at> (raw)
In-Reply-To: <dd09e24e-f89b-2a65-4246-e2c3babae49e@unix-solution.de>
References: <5a174fad-c30d-6d65-38c8-a3d9af8377df@unix-solution.de>
	<fa00b39eb7c7589cd604e386ff9ce59997906f5d.camel@cybertec.at>
	<34c739c1-b930-d58a-521b-c4a7b236d9bd@unix-solution.de>
	<f09b68f48506df4e122e279642f76165778b77fd.camel@cybertec.at>
	<dd09e24e-f89b-2a65-4246-e2c3babae49e@unix-solution.de>

On Fri, 2021-03-19 at 10:12 +0100, basti wrote:
> >> SELECT a.name
> >>      FROM foo as a
> >>      LEFT JOIN (SELECT name from foo WHERE name = 'lowercase name') as b
> >>      on a.name = b.name
> >>      ORDER by b.name,a.name
> >>
> >> does it.
> >>
> >> perhaps there is a better way?
> > 
> > Ah, I misunderstood what you want.
> > 
> >    SELECT a.name
> >    FROM foo as a
> >    ORDER BY a.name <> lower(a.name), a.name;
> > 
> > That works because FALSE < TRUE.
> 
> This does not work for me. The same result as normal order.
> 
> Amm
> andere Marken
> Ani
> Anti
> Bra
> Cali

You are allowed to adapt the query to your special needs.
But if you need to be spoonfed:

   SELECT a.name
   FROM foo as a
   ORDER BY a.name = initcap(a.name), a.name;

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






view thread (12+ messages)

Message-ID: <fe4c460dc7e6dc3201a4cfa0893dca2e04143987.camel@cybertec.at>
Permalink:  ../fe4c460dc7e6dc3201a4cfa0893dca2e04143987.camel@cybertec.at/
Also on:    postgresql.org/message-id/fe4c460dc7e6dc3201a4cfa0893dca2e04143987.camel@cybertec.at

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, mailinglist@unix-solution.de
  Subject: Re: postgresql order lowercase before uppercase
  In-Reply-To: <fe4c460dc7e6dc3201a4cfa0893dca2e04143987.camel@cybertec.at>
  References: <5a174fad-c30d-6d65-38c8-a3d9af8377df@unix-solution.de> <fa00b39eb7c7589cd604e386ff9ce59997906f5d.camel@cybertec.at> <34c739c1-b930-d58a-521b-c4a7b236d9bd@unix-solution.de> <f09b68f48506df4e122e279642f76165778b77fd.camel@cybertec.at> <dd09e24e-f89b-2a65-4246-e2c3babae49e@unix-solution.de> <fe4c460dc7e6dc3201a4cfa0893dca2e04143987.camel@cybertec.at>

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

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