0

我需要根据其他信息在表格中进行更新。如何进行?我的情况是:

我有一个列 iniciantes 表MEMB_INFO 我需要进行更新 MEMB_INFO SET iniciantes = 0 但我需要对WHERE表列进行查询重置字符表

例子:

UPDATE    MEMB_INFO
SET              iniciantes = 0
FROM         MEMB_INFO CROSS JOIN
                      Character
WHERE     (Character.Resets >= 100)

仅在参考字符大于或等于 100 的情况下才需要更新 memb_info

4

2 回答 2

1

只需将 MEMB_INFO 与您的Character表连接并指定它们的关系:

update m
set iniciantes = 0
from MEMB_INFO m
    inner join Character c on
    c.Resets >= 100 
    AND m.CharacterId = c.CharacterId  --Specify your tables' relations.
于 2013-08-11T06:07:43.653 回答
0

您必须指定要加入这两个表的列。如果您characterId 在两个表中都有列,则您的查询将是:

update MEMB_INFO set
    iniciantes = 0
from MEMB_INFO as m
where
    m.CharacterId in (
        select c.CharacterId from Character as c where c.Reset >= 100
    )
于 2013-08-11T08:50:35.203 回答