Click here to Skip to main content
15,923,051 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I want to select the latest record enter in the table with respect to given id.

e.g

ID Record Date
1 abc 01-02-2013
1 def 02-02-2013
1 ghi 03-02-2013

I want to select record where Date is 03-02-2013 its the latest one.
C#
Select * from Table where Id='Some id' and Date=
Posted
Updated 19-May-13 3:43am
v2

1 solution

Try:
SQL
SELECT TOP 1 * FROM MyTable WHERE id='Some id' ORDER BY [Date] DESC
 
Share this answer
 
Comments
Zain ul abdeen 19-May-13 10:04am    
Simple! Well thanks for your consideration :)
OriginalGriff 19-May-13 10:20am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900