tsql - Create a SQL query to retrieve most recent records -


I am creating status board modules for my project team. The status board allows the user to set their position or out and they can also provide a note. I was planning to store all the information in a table ... and the example of the data is as follows:

  Date User Status Notes ------------ - ----------------------------------------- 1/8/2009 12: 00pm for lunch in B.SOCO 1/8/2009 8:00 PM BScos 1/7/2009 at 5:00 PM in BSSCO 1/7/2009 8:00 PM 1 / 7/2009 at 8:00 p.m. On 1st January 2009 at 8.00 a.m. Janevay in Genwe January 1, 2009 at 8:00 in the morning. Piccard Out Holiday  

I want to query and return data to the most recent position for each user, in this case, my query will return the following results:

  Date user status notes ----------------- ----------------------- --------------- 1/8/2009 12:00 pm B. Asco for these lunch 1/7/2009 8:00 pm on January 1, 2009 at 8:00 am. Genwe J. Picard Out Holidays  

I'm trying to figure out the RANSACT-SQL to be this? Any help would be appreciated.

enter a subquery derived table and then join [SOMETABLE] Select [Max] as the latest date from [user] by [user] from Submax [SOMETABLE], select [max], select date from date, user, status, select user, status, notes. Date = submax LATESTDATE AND [ASSOCIATED] User = submax User


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -