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
 General SQL Server Forums
 New to SQL Server Programming
 unique timestamp

Author  Topic 

adamsmithhrs
Starting Member

2 Posts

Posted - 2007-11-06 : 09:45:52
Hi,

i need to create a sql statement to get the latest timestamp for a user and am struggling

my table once it has been joined has

employee id door permiter door time
1 1 yes 12/12/2002 10:00
1 1 yes 13/12/2002 10:00
1 1 yes 14/12/2002 10:00
2 1 yes 12/12/2002 10:00
2 1 yes 13/12/2002 10:00
3 1 yes 12/12/2002 10:00
4 1 yes 12/12/2002 10:00


So what i would like returned from this would be:
employee id door permiter door time
1 1 yes 14/12/2002 10:00
2 1 yes 13/12/2002 10:00
3 1 yes 12/12/2002 10:00
4 1 yes 12/12/2002 10:00

could someone give me a pointer on this....very new to SQL

thanks

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-11-06 : 11:44:41
Hint: GROUP BY Employeeid, door, permitter and do a MAX(Doortime).

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page
   

- Advertisement -