Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 4F239633955 for ; Mon, 19 Oct 2009 14:08:09 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 77367-02-3 for ; Mon, 19 Oct 2009 17:08:00 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from jupiter.marktest.pt (delta.marktest.pt [80.251.174.116]) by mail.postgresql.org (Postfix) with ESMTP id 4C93E6331E8 for ; Mon, 19 Oct 2009 14:07:59 -0300 (ADT) Received: from Proteu (proteu.marktest.pt [10.61.90.54]) by jupiter.marktest.pt with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id 4R8TK4PR; Mon, 19 Oct 2009 18:07:57 +0100 Message-ID: From: "Oliveiros C," To: "Adrian Klaver" , References: <6caee9520910140240u13daba93ua20637642727776e@mail.gmail.com> <99F66F53142145DE8127EAF7423AF726@marktestcr.marktest.pt> <200910141354.17785.aklaver@comcast.net> Subject: Re: How to order varchar data by word Date: Mon, 19 Oct 2009 18:07:57 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 1 X-MSMail-Priority: High X-Mailer: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.002 tagged_above=-10 required=5 tests=BAYES_50=0.001, STOX_REPLY_TYPE=0.001 X-Spam-Level: X-Archive-Number: 200910/70 X-Sequence-Number: 33269 Hello, Adrian. Thank you for your email. I am not using any SQL at this time, but I 'd like to understand what is exactly the criterion that the ORDER BY uses to order text. Giving you some background : I need to make an efficient join between data generated by my program and data output by postgres and of course, it is mandatory that both lists of records be ordered using the same criterion. I need to figure out what is exactly the criterion used by postgres so I can mimic it on my program. I thought it was ordinal, but it seems it isnt, as the @ symbol comes before the 0 (zero). According to ASCII numeric codes, it shouldn't If any one can explain me exactly how the order by clause works on varchars, I 'd really appreciate it. I've already examined documentation carefully, but couldn't find it. Maybe I looked on the wrong place... Best, Oliveiros ----- Original Message ----- From: "Adrian Klaver" To: Cc: "Oliveiros C," Sent: Wednesday, October 14, 2009 9:54 PM Subject: Re: [SQL] How to order varchar data by word > On Wednesday 14 October 2009 7:13:22 am Oliveiros C, wrote: >> Hello, list. >> >> I have a table with a varchar field that I would like to order by word, >> not >> by ordinal, which seems to be the default on postgres. >> >> Does anyone have a clue on how this can be done? >> >> Many thanx in advance, >> >> Best, >> Oliveiros > > Can you show the SQL you are using? > > -- > Adrian Klaver > aklaver@comcast.net > > -- > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql