help with t-sql self join

Posted by stackoverflowuser on Stack Overflow See other posts from Stack Overflow or by stackoverflowuser
Published on 2010-06-11T21:55:16Z Indexed on 2010/06/11 22:12 UTC
Read the original article Hit count: 267

Based on the following table

ID  Date         State 
-----------------------------
1   06/10/2010   Complete
1   06/04/2010   Pending
2   06/06/2010   Active   
2   06/05/2010   Pending

I want the following ouptut

ID  Date         State 
---------------------------
1   06/04/2010   Complete
2   06/05/2010   Active

So date is the earliest one and State is the latest one. I am failing to apply self join on the table to get the output.

Thanks

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about tsql