|
Posted by Oli Filth on 11/14/05 20:41
kenoli said the following on 14/11/2005 18:08:
> I am querying a mysql database and using ORDER BY in my query statement
> to order the results on a date field.
>
> It seems to be handling the day and year part OK, but when it orders
> the month part it is ordering by the first digit first, thus "10" is
> seem as "1" like this:
>
> 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9
>
> Is there some way I can tell it to order the months like this:
>
> 1,2,3,4,5,6,7,8,9,10,11,12
>
I've never seen that happen! If you're using a DATE field, then a date
isn't represented as a string (e.g. '2005-12-28') internally, not to
mention that even when dates are represented as strings (e.g. after a
PHP mysql_query()), they're shown as 'YYYY-MM-DD' by default, e.g.
'2005-01-01'. So the whole '10' coming before '2' is irrelevant.
Are you sure you're using a true DATE field, and not a string-type?
What's your query string?
--
Oli
[Back to original message]
|