我正在使用SQL Server並想要更新具有特定條件的表。這裏的前提是:更新SQL表而不創建重複項
Feature: ID FeatureName ApplicationId 1 Car 5 2 Car 6 3 Ship 5
Application: ID ApplicationName 5 Mobile 6 Server
現在我想達到兩個目的:
- 如果將在
Feature
表中的重複條目後更新然後刪除舊的條目。 - 在表
Feature
集合ApplicationId
到6
(=Server
)其中當前ApplicationId
是5(=Mobile
)。
因此,最終Feature
表應該是這樣的:
Feature: ID FeatureName ApplicationId 2 Car 6 3 Ship 6
我怎樣才能做到這一點?
你說要6其中值是5,而你的結果是5,而不是6 – jarlh
@jarlh當然,我已經改正了錯誤。 –