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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-05-09 : 08:23:48
|
| Tao writes "Say we have a table like this:ProjectID, UserID, comments, AddedTimeHere are some sample data:212, 44, 'Start now', '5/1/2005'345, 44, 'Start now', '5/1/2005'212, 46, 'Finish', '5/2/2005'Here are the result I want for Project 212:1, 212, 44, 'Start now', '5/1/2005'2, 212, 46, 'Finish', '5/2/2005'Did you that I want 1, 2 as an sequence number based on addeddate ?It seems that I may need to join the table to itself." |
|
|
JimL
SQL Slinging Yak Ranger
1537 Posts |
Posted - 2005-05-09 : 09:02:16
|
| Just dump into a temp table with an ID field.Select IDENTITY (int, 1, 1) as IDfield,ProjectID, UserID, comments, AddedTimeInto #tempProjectFrom yourtableOrder by AddedTimeSelect IDfield,ProjectID, UserID, comments, AddedTimefrom #tempProjectorder by IDfieldJimUsers <> Logic |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2005-05-09 : 10:35:08
|
| "You're dangerous""That's right ice....man...I am dangerous"Don't you alread have a sequesnce in the original IDENTITY column?Brett8-) |
 |
|
|
|
|
|
|
|