本文介绍了如何从表中检索最新插入或更新的标识?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.
我想从表中检索最新插入的或更新的标识.但是,每当我编写以下代码时,根本没有结果.

Hi.
I would like to retrieve the latest inserted or even updated identity from a table.but whenever i write the following code there is no results at all.

select * from PersonHowEducation prh inner join HowzeEducation he on
              prh.HowzeEducationId=he.HowzeEducationId
              where he.HowzeEducationId=@@IDENTITY



我该怎么办?



what shall i realy do ?

推荐答案

SELECT * FROM PersonHowEducation prh INNER JOIN HowzeEducation he ON
prh.HowzeEducationId=he.HowzeEducationId ORDER BY he.LastUpdatedDate DESC



这将以LastUpdatedDate列的降序为您提供更新记录的列表.您可以根据自己的需求自定义查询.


--Amit



This will give you a list of updated records in descending order of LastUpdatedDate column. You can customize the query according to your wish.


--Amit



这篇关于如何从表中检索最新插入或更新的标识?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 16:51