FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Sorting result MySql





sonam
Code:
$result = mysql_query("SELECT * FROM my table ORDER BY name ASC");

This sorting is giving me 99% good result but in some situation I need aditional sorting by another column (surname). I MUST sort by name, and I cannot to sort by any other column. Here is simple table (id, name, surname):

Code:
id1 John ONE
id2 John TWO
id3 John ONE


I need:
Code:

id1 John ONE
id3 John ONE
id2 John TWO

How I can include one aditional check by surname?

Sonam
Peterssidan
Code:
$result = mysql_query("SELECT * FROM my table ORDER BY name ASC, surname ASC");
sonam
Thanks, I was thinking it is something simple but I haven't time for experiments.

Thanks, a lot. Very Happy

Sonam
Related topics
E-Cards with PHP & MySQL
HTTP AUTH with PHP and mySQL
Build an online dictionary by PHP/MySQL
Make search engine With PHP and mySQL, for your site
An Example to mySQL class
Separating contents of MySQL row and put them in variables?
a grouping question?
SELECTing from MySQL with PHP
[solved] Weird mysql error
[mySQL] Error I cannot Debug
A very good PHP MySQL Tutorial
mysql gives the wrong result [solved]
Automatic download start !!
Subtracting one value from another from MySQL result
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.