Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a table like this..

SQL
id, P_id


and values like this
SQL
1, H-123
2, GD-45563
3, 34545


i want order by 34545,GD45563,H123...

please help me ..

thanks...
Posted
Updated 19-Sep-13 23:31pm
v3
Comments
gvprabu 20-Sep-13 6:20am    
Give some more Information... Exactly Wht based u need to Sort?
Member 10112611 20-Sep-13 7:49am    
if your table contains the below data

1 H-123
2 GD-45563
3 34545
4 N-05696
5 N-5631


can u tell me the order you need?
krrazyumesh 26-Sep-13 2:44am    
I want like this order

34545
GD-45563
H-123
N-5631
N-05696


Thanks...

1 solution

what's wrong with
SQL
select id, P_id from my_table order by P_id

?
 
Share this answer
 
Comments
krrazyumesh 20-Sep-13 6:12am    
it works but i have value of P_id like N-05696,N-5631. According to u it order like N-05696,N-5631 but i want like N-5631,N-05696
Maciej Los 20-Sep-13 6:46am    
Why?
Maciej Los 20-Sep-13 7:01am    
Looks perfect!
+5
CPallini 20-Sep-13 7:10am    
Thank you.

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