Jump to content

How to show particular row always at first??


watsmyname

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.