数据库的表是没有主键的,更新的表结构有字段
fchrItemID ,
fchrBatchCode,
fdtmProduceDate,
fdtmInvalidDate ,(有效期)
flotQuantity(数量)
如何更新有效期最早的记录的flotQuantity ,谢谢
fchrItemID ,
fchrBatchCode,
fdtmProduceDate,
fdtmInvalidDate ,(有效期)
flotQuantity(数量)
如何更新有效期最早的记录的flotQuantity ,谢谢
set flotQuantity='xxx'
where
fdtmInvalidDate=(select top 1 fdtmInvalidDate from tb order by fdtmInvalidDate)
update
tb
set
flotQuantity='xxx'
where
fdtmInvalidDate=(select min(fdtmInvalidDate) from tb)