Received: from tomts6-srv.bellnexxia.net (tomts6.bellnexxia.net [209.226.175.26]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f4B1sTA55123 for ; Thu, 10 May 2001 21:54:29 -0400 (EDT) (envelope-from fbax@sympatico.ca) Received: from acer ([64.229.20.206]) by tomts6-srv.bellnexxia.net (InterMail vM.4.01.03.16 201-229-121-116-20010115) with SMTP id <20010511015401.LDQU7009.tomts6-srv.bellnexxia.net@acer>; Thu, 10 May 2001 21:54:01 -0400 Message-Id: <3.0.6.32.20010510215301.01ec9b50@pop6.sympatico.ca> X-Sender: b1wudu74@pop6.sympatico.ca X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.6 (32) Date: Thu, 10 May 2001 21:53:01 -0400 To: pgsql-sql@postgresql.org From: Frank Bax Subject: Re: Order by email address by domain ? Cc: herve@elma.fr In-Reply-To: <3AFADFFD.E6EF7225@elma.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by postgresql.org id f4B1sTA55125 X-Archive-Number: 200105/82 X-Sequence-Number: 2883 Why is everyone else suggesting new functions? This works (in 6.5.3): ORDER BY lower(substring(email from position('@' in email)+1 )), lower(email) remove the lower() functions if you don't need them (I had mixed case addresses). I am guessing/assuming that it's cheaper to just use entire email address in second key rather than extract before the '@' character. Frank At 08:37 PM 5/10/01 +0200, you wrote: >Hi, > >I just want to order by a listing of email address by domain like : > >toto@aol.com >tutu@aol.com >toto@be.com >tutu@be.com >toto@yahoo.com > >Is it possible and how ? > >Thanks ! >-- >Hervé Piedvache > >Elma Ingenierie Informatique >6, rue du Faubourg Saint-Honoré >F-75008 - Paris - France >http://www.elma.fr >Tel: +33-1-44949901 >Fax: +33-1-44949902 >Email: herve@elma.fr > >---------------------------(end of broadcast)--------------------------- >TIP 6: Have you searched our list archives? > >http://www.postgresql.org/search.mpl >