Jump to content

Recommended Posts

Greetings,

 

I have to fetch numbers of row in ascending order. However my problem is that among these rows i want one row to appear always at top and rest in ascending order. For example, i want the row with id 17 to be appeared always on top . I know this can be achieved with two different  sql statements. First display row with id 17, and next loop through the other rows. However i want to achieve this with a single sql statement. Is it possible??

 

Thanks

Watsmyname

well i solve it but however i ran into problem. I have to show that particular id on the top, and rest should be sorted date wise.

 

I changed the code to

 

select * from table_name  order by field(id,'17'),created_date DESC 

 

But this yielded an unpleasant result. It sorted all the rows  by "created_date" ignoring first part of sort condition.

 

And "Mark Unsolved" Button is not working as well!

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.