[AccessD] Sort mixed alpha numeric data

Gustav Brock gustav at cactus.dk
Tue Jun 17 02:12:45 CDT 2003


Hi John

> I have a test field where the data is generally 1,2,3,4,5 but can also
> include 1a, 1b, 1c.

> Would any one happen to have ideas for a way (or code for a function that
> will) sort mixed data numerically first and then alphabetically?

So how are you sorting them now? The data must be strings and sorted
as such. Or do you have data with more than one digit, like 15c?

If so, sort on the numeric value then the ascii value:

<SQL>

  SELECT
    *
  FROM
    tblYourTable
  ORDER BY
    Val(StringID),
    StringID;

</SQL>

/gustav



More information about the AccessD mailing list