Search Postgresql Archives

Re: sorting library of congress numbers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@xxxxxxxxxxxxxx)


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux