How do i sort the data in Sql server.

Posted by Mahe under Sql Server on 3/28/2013 | Points: 10 | Views : 894 | Status : [Member] | Replies : 3
Hi All,

How do i sort the data in Sql server.

Secnario: If the values are 1,10,30,3,5
The requirement is to get this series: 1,3,5,10,30

on using Order by clause we get: 1,10,3,30,5 which i dont required.


Any approach to acheive that ?




Responses

Posted by: Mohansubramanian on: 3/28/2013 [Member] Starter | Points: 25

Up
0
Down
Hi

select * from table1
order by empid asc

Regards,
Mohan Subramananian
powerofmicrosoft.blogspot.in

Regards,
Mohan Subramanian
http://mohanks.com

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Murugavelmsc on: 3/28/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,

select * from tablename order by id

Regards,
Murugavel S
murugavel.sadagopan@gmail.com
http://murugavelmsc.blogspot.in/

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sriramnandha on: 5/11/2013 [Member] Starter | Points: 25

Up
0
Down

ASCENDING ORDER :

SELECT * FROM PRODUCTS ORDER BY PRODUCTID

DESCENDING ORDER:

SELECT * FROM PRODUCTS ORDER BY PRODUCTID DESC



sriram

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response