Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 SQL Server SELECT rows based on customized order

Author  Topic 

Srinivasan__
Starting Member

1 Post

Posted - 2011-05-25 : 05:25:08
I have table called UsersList which contains the following rows
ID Name Password
== ==== =========
1 NoName1 NoPassword1
2 NoName2 NoPassword2
3 NoName3 NoPassword3
4 NoName4 NoPassword4
5 NoName5 NoPassword5
6 NoName6 NoPassword6






I want to use SELECT query to display like below fashion
ID Name Password
== ==== =========
5 NoName5 NoPassword5
3 NoName3 NoPassword3
6 NoName6 NoPassword6
4 NoName4 NoPassword4
1 NoName1 NoPassword1
2 NoName2 NoPassword2

Any help on this...

Thanks in advance

Bazalddo
Starting Member

22 Posts

Posted - 2011-05-25 : 05:30:24
Hi,

One way you could do it is when you insert the rows into the table assign them an order e.g.

SELECT ID, Name, Password, 1 AS Order

Then when you run the query order by the 'Order' column

The only downside to this is that it is a bit long winded when creating the table but that is the only way I know how to do it.

Hope this helps

Shahbaz Ahdi
Apps Developer
ODEON/UCI Cinema
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2011-05-25 : 11:56:18
Is there a formula for how to determine the order or is it just random?
Go to Top of Page
   

- Advertisement -