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 |
|
pareshmotiwala
Constraint Violating Yak Guru
323 Posts |
Posted - 2009-10-08 : 10:46:03
|
| folks I have a table T1 with 20 fields.Three of the fields are COMPUTER_NAMECOMPUTER_TASKTIMESTAMP_OF_TASKThe dataset can be as followsComputer_name Computer_task Timestamp_of_taskParesh_PC reboot time1Paresh_PC patched time2Paresh_PC infected time3Paresh_laptop cured time1Paresh_laptop reformatted time2Paresh_server bought time1Paresh_server installed time2and so on.What I have been asked to do is to come back with a query that would say what is the last computer_task that was performed to each of the computers.Any ideas?As usual, any help is welcomePareshRegardsParesh MotiwalaBoston, USA |
|
|
waterduck
Aged Yak Warrior
982 Posts |
Posted - 2009-10-08 : 13:37:09
|
SELECT Computer_name, Computer_task, MAX(Timestamp_of_task)FROM <tablename> Hope can help...but advise to wait pros with confirmation... |
 |
|
|
pareshmotiwala
Constraint Violating Yak Guru
323 Posts |
Posted - 2009-10-08 : 13:49:48
|
| Thanks for the input Waterduck.When I do this I get almost all the rows back. mainly because each of the computer task is different and in quick succession.RegardsParesh MotiwalaBoston, USA |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-10-09 : 02:52:01
|
| What is your expected result?MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|