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 |
wagau999
Starting Member
5 Posts |
Posted - 2008-11-06 : 06:13:28
|
Hi there,i am using SQL Server 2000 and T-sqlI have a report i want to create which will show me infomation like the following:LoginID , Start_Date, End_Date and Total TimeHowever all this information is heald in one table but the info comes like thisLoginID Start_Date End_Date Total Time1 12-04-07 00:10:00 12-04-07 00:20:00 101 12-04-10 01:10:10 12-04-10 00:20:00 302 12-04-07 00:10:00 12-04-07 00:20:00 102 12-04-07 02:10:00 12-04-07 00:20:00 102 12-04-07 03:10:00 12-04-07 00:20:00 103 12-04-07 04:10:00 12-04-07 00:20:00 10Now i would like to see the data like this in a linear fashion:'First row' 1 12-04-07 00:10:00 12-04-07 00:20:00 12-04-10 01:10:10 12-04-10 00:20:00 40'Second row' 2 12-04-07 00:10:00 12-04-07 00:20:00 12-04-07 02:10:00 12-04-07 00:20:00 12-04-07 03:10:00 12-04-07 00:20:00 30However differnt Loginid will have different Start_Date and End_Date of data in it so some may have 5 rows othere could have ten?is this possiable ?Thank youGaurav"A successful man is one who can lay a firm foundation with the bricks others have thrown at him." |
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2008-11-06 : 06:16:14
|
You are better doing this in whatever front end app you are using (if you are using one) That said there are many many posts on this site for pivoting info. Just look for rows to columns. etcIN 2005 this would be a lot easier to do with TSQL as you have the PIVOT operator.Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
|
|