From: | Doug McNaught <doug(at)wireboard(dot)com> |
---|---|
To: | "Stoppel, Brett W" <bstoppel(at)ku(dot)edu> |
Cc: | "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: ORDER BY and ignoring the , a , and an |
Date: | 2001-03-29 20:06:41 |
Message-ID: | m366gsqqzy.fsf@belphigor.mcnaught.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Stoppel, Brett W" <bstoppel(at)ku(dot)edu> writes:
> Is it possible to have the ORDER BY option ignore the articles "the ", "a ",
> and "an " at the beginning of a VARCHAR, CHAR, TEXT, et cetera field? In
> other words, I want my results to come back alphabetized, while ignoring the
> aforementioned articles.
Only way I can think of would be to write a function to do the
stripping yourself, say 'strip_articles(text) RETURNS text' and then
in your SELECTS, do 'ORDER BY strip_articles(mycolumn)'. For
performance you might also want to create an index on that same
expression.
You could write the function in any of the available server-side
languages (pgsql, perl, tcl).
-Doug
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-03-29 20:07:02 | Re: missing data |
Previous Message | Gregory Wood | 2001-03-29 20:02:18 | Re: ORDER BY and ignoring the , a , and an |