Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How do I sort on final digit of a number?

Re: How do I sort on final digit of a number?

From: Wayne Menzie <waynem_at_bosmedtechdotcom.nospam>
Date: Thu, 20 Jan 2000 16:02:27 GMT
Message-ID: <8EC1794C7wayneshammalammading@129.250.35.141>


jcmanNOSPAM_at_worldnet.att.net (Buck Turgidson) wrote in <865r5r$cov$1_at_bgtnsc01.worldnet.att.net>:

>> >order by substr(to_char(test_id), length(to_char(test_id)))
>>
>> Thank you Sybrand. That does the sort on the last number perfectly.
>>
>> I had a suggestion to use the following:
>>
>> ORDER BY MOD(Test_id, 10)
>>
>> Would this be a more efficient means of doing this? Both seem to work
>> properly.
>
>Either way, you won't use an index, so I don't think efficiency is an
>issue, unless your CPU is an 8088, and has trouble doing the function.

The last number of Test_id indicates the original site that received teh data. Would it be better to denormalize the database and create a field called site_id so I could create an index on site_id and order or select based on the index?

Wayne Menzie Received on Thu Jan 20 2000 - 10:02:27 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US