本文介绍了sqlserver查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

选择前5个tblIncidentManagement.IncidentName,tblIncidentManagement.IncidentCode,tblIncidentManagement.IncidentId
从tblAdminMaster内联接tblIncidentManagement ON tblAdminMaster.AdminId = tblIncidentManagement.AdminId
在哪里(tblAdminMaster.AdminId = @CreatedFromId)和tblIncidentManagement.IsDelete = 0
我想在上面的查询中使用ID desc的顺序,以便获得5条最近的记录.

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

推荐答案



这篇关于sqlserver查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 08:39