If the fields are not numeric fields then you are left with 1) parsing the
string fields prior to sorting or 2) sorting by the string values as they
are.  To avoid parsing, you could change the values in the db (once) to
something that would sort more easily, like "0001:0001-0005" instead of
"1:1-5".  You have to decide in advance how many digits to use, but I
suspect that you can guess a decent upper limit.  Anyway, with the values
formatted that way you can just use a normal string ORDER BY to get the
order you want.


Parsing "1:1-5" into the numeric values 1 and 1 (ignoring the "-5" part)
isn't too hard, but the exact syntax may depend on your sql server.  If
you've got a big database you may want to avoid parsing though.


    Mark

-----Original Message-----
From: Rick Faircloth [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 20, 2004 12:54 PM
To: CF-Talk
Subject: How can I order these values numerically?

Hi, all...

How can I order these values numerically?

1:1-5
1:14-18
1:6-8

How can I, without making the db field a numeric field rather than a varchar
field,
cause these values to be ordered this way:

1:1-5
1:6-8
1:14-18

Thanks for your help...

Rick

--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.241 / Virus Database: 262.10.2 - Release Date: 5/18/2004
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to