Click here to Skip to main content
15,881,787 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
in a table i have six row but the order of rows are not according to my needs. i want to order those row by my needs. how can i do this
Posted
Comments
Azee 1-Oct-13 1:39am    
By " order those row by my needs" do you mean in a Select statement?
Muhamad Faizan Khan 1-Oct-13 1:54am    
no in database. in select we can use order by clause. But i want to order in table
Azee 1-Oct-13 1:57am    
So you are saying you want to change the order by which the rows are saved in the database table? and why does that even matter when you can order them anyway you want in your queries?
Muhamad Faizan Khan 1-Oct-13 2:07am    
ok how to do it?? in query i only know about ascedning and descending order
Azee 1-Oct-13 2:09am    
Hey, I am asking why do you need to do that when you can do sorting in the query? Give me a good reason then I'll suggest a solution.

You can use order by clause to order data as per your needs.
If you want record to be stored in specific order then it cant be done as record are inserted in database as first come first serve basis. And even if records are stored in any order in database you can always 'Order By. your queries and views.
 
Share this answer
 
Here:

Check this example and let me know if it doesn't clear your concept:

http://www.w3schools.com/sql/sql_orderby.asp[^]

If you have issue ordering in a specific Sql query, then post it, I'll take a look.

Azee...
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900