update abc set outdate=getdate() where username=admin and id=3
update abc set outdate=getdate() where id=(select max(id) from abc)
declare @abc table(id int,username varchar(10),outdate datetime)
insert into @abc select 1,'admin','2008-08-10'
union all select 2,'admin','2008-08-12'
union all select 3,'admin','2008-08-15'
update a set a.outdate=getdate() from @abc a join (select top 1 * from @abc order by id desc)b
on a.id=b.id
select * from @abc
1 admin 2008-08-10 00:00:00.000
2 admin 2008-08-12 00:00:00.000
3 admin 2008-11-01 11:28:34.920
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。