joecooper Posted March 14, 2006 Share Posted March 14, 2006 im trying to do a mysql query, where it lists the rows in order of a number from 1 to 5 thats in 'goldstars' feild.Some of the numbers in the rows are the same, so 2 can be the same number. and for this it gives error. how can i make it list by goldstars, and like if there is 2 the same, then move one to the top and other under it.ThanksJoe Cooper Quote Link to comment Share on other sites More sharing options...
obsidian Posted March 14, 2006 Share Posted March 14, 2006 well, for something where you may have more than one record returned, you'll probably get the best results to order by more than just one column. for instance, if you're pulling a column called username and one called goldstars, i'd recommend running a query like this:[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] username, goldstars [color=green]FROM[/color] [color=orange]tableName[/color] [color=green]ORDER BY[/color] goldstars, username;[!--sql2--][/div][!--sql3--]now, if you're actually getting a MySQL error, if you'll post the error you're receiving, i'm sure we can help you through that as well. Quote Link to comment Share on other sites More sharing options...
joecooper Posted March 14, 2006 Author Share Posted March 14, 2006 great! that works, thanks...i forgot the Thing for deaccending... opersite to ASC?? Quote Link to comment Share on other sites More sharing options...
annihilate Posted March 14, 2006 Share Posted March 14, 2006 Use DESC to order descending[code]ORDER BY column_name DESC[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.