L
L
Lavrov952018-10-09 16:58:43
SQL
Lavrov95, 2018-10-09 16:58:43

How to change the values ​​in the table?

How can I change all US_CITIES.ID_STATE values ​​to US_STATES values. STATE_CODE where US_CITIES.ID_STATE equals US_STATES.ID?
US_CITIES
ID | ID_STATE | CITY
US_STATES
ID | STATE_CODE | STATE_NAME

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osin, 2018-10-09
@Telsir

update US_CITIES usc
join US_STATES uss
on usc.ID_STATE = uss.ID
set usc.ID_STATE = uss.STATE_CODE
where usc.ID_STATE = US_STATES.ID
if I understand your ID logic correctly

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question