Click here to Skip to main content
14,635,816 members
Rate this:
Please Sign up or sign in to vote.
See more:
SELECT top 5 tblIncidentManagement.IncidentName,tblIncidentManagement.IncidentCode, tblIncidentManagement.IncidentId
FROM tblAdminMaster INNER JOIN tblIncidentManagement ON tblAdminMaster.AdminId = tblIncidentManagement.AdminId
WHERE (tblAdminMaster.AdminId = @CreatedFromId) and tblIncidentManagement.IsDelete=0
i want use order by id desc in above query so i can get 5 recent records
Posted
Rate this:
Please Sign up or sign in to vote.

Solution 1

So whats wrong , just add ORDER BY tblIncidentManagement.IncidentId DESC at the end and you will get top 5 records.
   
v2
Rate this:
Please Sign up or sign in to vote.

Solution 2

I suggest you read one of the many basic SQL tutorials on the web, or perhaps even buy a book.
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100