Re: order by ASC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



John Taylor-Johnston wrote:
Ok, I think this is a MySQl question. Take pity on me?

$sql = "SELECT * FROM $db.`mailinglist` WHERE `type` IN ('Member', 'Affiliated', 'Life Member') ORDER BY `rollnumber` ASC";

rollnumber is a varchar(50). I need it to be a text field. ASC does not order the way I want.

1000
1001
998
999

I want it to order like this:

998
999
1000
1001

How do I trick it? I cannot think of a way in MySQL. Is there a way in PHP?

CAST it to an integer in the ORDER BY clause.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux