Click here to Skip to main content
16,017,297 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to get 3 datas which has been added lastly with 'select command'.But,the commands which I have done,not first three command but also all of them or Am I going to add a counter or something like that?Could you help me,please?
Posted

1 solution

If you really want to retrieve the last three items added to a database, then I would use a database field to hold the entry date and time, and retrieve the TOP three items sorted by that field:
SQL
SELECT TOP 3 * FROM myTable ORDER BY datePosted DESC
 
Share this answer
 

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