我正在使用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当然,我已经改正了错误。 –