=?utf-8?B?QWJvdXQtdHcuY29tIOWFjeiyu+S6uuWKm+mKgOihjA==? writes:
> Dear All,
As I understand this, what you would really LIKE to do would be to
sort/collate by the underlying numeric representation, rather than
by the abstraction of the values provided through ENUM. Some
rather sophisticated work-arounds have been suggested to layer
MORE abstraction on top of this to get your desired result,
but I would like to offer, for your consideration, a step backwards
to a simpler implementation.
Create another table that maps diploma codes to diploma names.
1 "junior_high"
2 "senior_high"
3 "junior_college" (in some places, "associate")
4 "university"
5 "master"
6 "doctor"
You might even choose to go by tens to allow near-aliases or
finer shades of meaning to be added in the future without having
to re-org the dependent tables.
Then, use table joins (or views) where you want the names, and
use the "raw" numeric field when you want to sort by the representation
value.
If you want to get at the underlying representation, ENUM is the
wrong thing to use -- it is built to hide that representation.
If you need access to that representation, do so explicitly.
SELECT from * table1,table2 WHERE table2.dc_key = table1.diploma_code
AND table1.diploma_code = 2
and so forth.
This is what joins and views do pretty well.
It will also allow you to do what you indicated you wanted to do
in later messages, which would be to SORT by the diploma_code, but
still display the value. Furthermore, you are free to use regular
text, without underscores or other restrictions, in the
diploma names.
I hope that this approach may offer or suggest something of value.
--
John Lind
[EMAIL PROTECTED]