Jump to content

ORDER BY goldstars ASC


joecooper

Recommended Posts

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.
Thanks
Joe Cooper
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.