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.
| Author |
Topic |
|
elwoos
Master Smack Fu Yak Hacker
2052 Posts |
Posted - 2003-02-04 : 04:23:14
|
| Is it possible to number the results of a select statement? I am putting a hospital waiting list onto SQl server 7 and need to number the results of certain queries. For example I would need select * from Patientto return something like1 Bloggs, Joe2 Jones, Joe...So that if someone rings up we can give then an idea where they are on the waiting list and so how long before they will be seenthanks in advancesteveelwoosAThotmail.com |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-02-04 : 04:26:11
|
| You can do it in the select statement if you have a unique field by just using count(*) in a subquery to get all the enrties ahead of this one.Putting the result into a temp table with an identity and selecting from there will be more flexible though.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
elwoos
Master Smack Fu Yak Hacker
2052 Posts |
Posted - 2003-02-04 : 04:38:35
|
| that's great,thankssteve |
 |
|
|
|
|
|