Reputation: 1
I need to make an update in a table based on other information. How to proceed? My case is:
I have a column iniciantes table MEMB_INFO
I need to make an update MEMB_INFO SET iniciantes = 0
But I need to make a query on WHERE
table column resets the character table
Example:
UPDATE MEMB_INFO
SET iniciantes = 0
FROM MEMB_INFO CROSS JOIN
Character
WHERE (Character.Resets >= 100)
necessary that the update the memb_info only occur in cases where the reference character is greater than or equal to 100
Upvotes: 0
Views: 67
Reputation: 117520
you have to specify columns on which you're joining this two tables. If you have characterId
column in both tables, your query will be:
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
)
Upvotes: 0
Reputation: 18797
Simply, join MEMB_INFO with your Character
table and specify their relations:
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.
Upvotes: 1