update tblExample
set value = 14
where tripID = 2 and
dates = (select max(e2.dates)
from tblExample as e2
where e2.tripID = tblExample.tripID
);
或者基于 id :
update tblExample
set value = 14
where tripID = 2 and
id = (select top (1) e2.id
from tblExample as e2
where e2.tripID = tblExample.tripID
order by e2.dates desc
);
1条答案
按热度按时间7xllpg7q1#
可以在中使用子查询
where
子句以筛选到所需的行:或者基于
id
: