| From: | Scott Marlowe <smarlowe(at)g2switchworks(dot)com> |
|---|---|
| To: | Rick Schumeyer <rschumeyer(at)ieee(dot)org> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: sorting library of congress numbers |
| Date: | 2005-01-19 22:53:47 |
| Message-ID: | 1106175227.23377.80.camel@state.g2switchworks.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Wed, 2005-01-19 at 16:37, Rick Schumeyer wrote:
> I have a table where one of the columns is a library of congress
> number.
>
> I would like to be able to ORDER BY this column.
>
>
>
> Currently, the column is a varchar. Unfortunately, a normal string
> comparison
>
> will not work.
>
>
>
> First, has anyone done this already?
>
>
>
> If not, I’m thinking I would need to:
>
> 1) define a new type to hold LOC numbers.
>
> 2) write a function that determines less than, greater than
>
>
>
> It seems like I’m missing something here. I have not yet defined a
> new
>
> type…is defining less/greater part of that process?
>
>
>
> Is there a simpler way to do this?
You might want to do something along the lines of storing the PARTs of
the loc number, then using lpad/rpad in a function to put them together
in such a way to as to render them orderable. Is there an URL on how
LOC numbers are ordered?
| From | Date | Subject | |
|---|---|---|---|
| Next Message | J. Greenlees | 2005-01-19 23:02:16 | Re: Unique Index |
| Previous Message | Stuart Bishop | 2005-01-19 22:50:43 | Re: Multiline plpython procedure |