有2张表
dbo.ShipH
有以下的列
Invoice Customer
dbo.ShipD
有以下的列
Invoice InvoiceBr ST InvoiceDate
dbo.ShipH的 Invoice和dbo.ShipD的Invoice是一样的
现在知道 顾客id 和时间区间 FM 和TO
想将 Customer= 顾客id InvoiceDate> FM InvoiceDate<To 的 ST改为001
想了好久不好写。谢谢
------解决思路----------------------
update a
set a.ST='001'
from dbo.ShipD a
inner join dbo.ShipH b on a.Invoice=b.Invoice
where b.Customer=[顾客id] and a.InvoiceDate>[FM] and a.InvoiceDate<[To]