Hit upon a problem with some code of mine.
I've got a set of data that represents events for a local agricultural show. Data structure is:
id (int, auto_increment, primary)
class (varchar(10))
title (varchar(40))
... some other fields.
When displaying the events on a page, I sort by class in ascending order. Classes are usually a number, anywhere from 1 to God knows what.
However, occasionally, the class needs a letter (that being the reason why the field is a varchar as opposed to an int, which would solve the problem)
Now, when I do the "SELECT * FROM events ORDER BY class ASC" query, the classes get sent back in this order:
10
11
12
13
1
2
3
.. etc.
Is there anyway around this that doesn't involve changing the field type to int? 🙂
Thanks all.