Jump to content

Recommended Posts

I was going to provide an example in the first place, however, I could not think of a way to explain it... anyway, I will attempt to.

 

Um, if you had 3 rows within a table, would it be possible to make the query order by the number of rows? For example...

 

$result= mysql_query("SELECT * FROM Table ORDER BY [NumberOfRows] DESC");

Cless, I am still not clear. What do you mean by "order by the number of rows". Is it like that if there are 3 rows, 1st row comes first, then 2nd etc? Thre is no point of this though, coz it will come the sameway !! Else, if you said, it means "ORDER BY 3", i'll be more confused.

You need to specify a column name with ORDER BY.  Think about it.  If you had a list of fruit, and you wanted to order them, you could order by...alphabetically.  Or by... shortest to longest word.  But what you are trying to do is order by...3.  What does 3 have to do anything with your list of fruit?  How would I use "3" to determine which comes first, the orange or the banana?  So do you now see how that makes no sense?  So maybe you need to give a "before" and "after" example.  

 

Only other thing I can think of is, are you trying to order it differently, depending on how many rows are in the table? For instance, if there are 3 rows, you'd want to order them by columnA, but if there are 4, you want to order them by columnB?

 

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.