mforan Posted April 10, 2008 Share Posted April 10, 2008 Ok im just wondering weather it would be possible after ordering the query by "power desc" that the database order after that is also taken into consideration. thats quite confusing to explain, so il explain a lil more, a user signs up, 1,2,3,4,5 users sign up etc. so when the query orders them it does just this, however, if 2 of the same person have the same power value in the database, the entry higher above will come first in the outputted results echo'd so basically, i was wondering if there is a way to bypass this and also order it by another... or is there no way to do this? $query = "SELECT name,rank FROM users ORDER BY power DESC"; output: person 1 - 2000 person 2 - 3000 person 3 - 4000 person 4 - 4000 person 5 - 5000 database from top to bottom of the entrys: 1.person 5 - 5000 2.person 3 - 4000 3.person 4 - 4000 4.person 2 - 3000 5.person 1 - 2000 hope this explains the problem.... Link to comment https://forums.phpfreaks.com/topic/100523-solved-outputted-order/ Share on other sites More sharing options...
cooldude832 Posted April 10, 2008 Share Posted April 10, 2008 you can order by multiple fields if that is what u are asking? Link to comment https://forums.phpfreaks.com/topic/100523-solved-outputted-order/#findComment-514136 Share on other sites More sharing options...
mforan Posted April 10, 2008 Author Share Posted April 10, 2008 so if "ORDER power, blah" it should order by power then blah afterwards then after that database order? Link to comment https://forums.phpfreaks.com/topic/100523-solved-outputted-order/#findComment-514140 Share on other sites More sharing options...
cooldude832 Posted April 10, 2008 Share Posted April 10, 2008 so if "ORDER power, blah" it should order by power then blah afterwards then after that database order? and did u try it??? Link to comment https://forums.phpfreaks.com/topic/100523-solved-outputted-order/#findComment-514144 Share on other sites More sharing options...
mforan Posted April 10, 2008 Author Share Posted April 10, 2008 ORDER BY power DESC, power2 DESC that worked, for anyone with this problem so: $query = "SELECT name,rank FROM users ORDER BY power DESC, power2 DESC"; Link to comment https://forums.phpfreaks.com/topic/100523-solved-outputted-order/#findComment-514248 Share on other sites More sharing options...
cooldude832 Posted April 11, 2008 Share Posted April 11, 2008 ORDER BY power DESC, power2 DESC that worked, for anyone with this problem so: $query = "SELECT name,rank FROM users ORDER BY power DESC, power2 DESC"; see what happens if you try and you fail at worse you get an error message. Link to comment https://forums.phpfreaks.com/topic/100523-solved-outputted-order/#findComment-514425 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.