Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to select last inserted two rows from my table. How can I do that?

Secondly I have an Employee Table I want to select those 5 employee whose salary is maximum.

Please guide
Posted
Updated 15-Feb-11 14:29pm
v3
Comments
Sandeep Mewara 15-Feb-11 9:43am    
Any effort?

1 solution

SQL
SELECT TOP(2) * FROM [tablename] ORDER BY Id DESC

second is
SQL
SELECT TOP(5) * FROM [table] ORDER BY salary DESC
 
Share this answer
 
v2
Comments
Pravin Patil, Mumbai 15-Feb-11 8:31am    
Good answer Richa....

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