mysql - Order by selected record in sql -


i have table like

city | pincode  abcd | 123456 xyz  | 326545 asd  | 625844 city | 999999 

and want result sorted selected pincode first

if select pincode 625844 city asd must show first

desired output:

    city | pincode      asd  | 625844  <<-- selected pincode must first     abcd | 123456     xyz  | 326545     city | 999999 

select * tbl  order (case when pincode = '625844' 0 else 1 end), pincode 

or if selected pincode being passed in parameter @pincode, should work

select * tbl  order (case when pincode = @pincode 0 else 1 end), pincode 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -