Link to home
Create AccountLog in
Avatar of VasuSidhu

asked on

SQL Server 2008

I have a table in sql with 3 columns.

File#      Status      Exportdate
1      a      1-Jul
1      s      9-Jul
1      d      11-Jul
1      f      13-Jul
1      g      15-Jul
1      h      10-Aug
1      j      20-Aug
2      f      2-Jul
2      a      11-Jul
2      s      31-Jul
2      d      9-Aug

I want the status of the file having last date.
for eg the output of the query should be

File#      Status      ExportDate
1      j      20-Aug
2      d      9-Aug
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SELECT TOP 2 * FROM table order by Exportdate desc
sorry I did it wrong