|
There are 2 tables in the library, table A and table B
The fields in table A are as follows
ID AREA CITYID
1 Beijing Chaoyang District NULL
2. Nanshan District, Shenzhen, Guangdong, China 1 NULL
3. Futian District, Shenzhen City, Guangdong Province NULL
4. Nanshan District, Shenzhen City, Guangdong Province 2 NULL
5. Guangdong Province NULL
Table B fields
ID CITY SZCODE
Beijing 110000
2. Chaoyang District 110105
3. Guangdong Province 440000
4. Shenzhen 440300
5. Nanshan District 440305
Now I want to fill the CITYID in table A with the SZCODE in table B
Insert CITYID after comparing AREA of table A and CITY of table B
The data in table A is about 300,000, and the data in table B is the administrative division of China.
The effect of table A replacement is as follows:
ID AREA CITYID
1 Beijing Chaoyang District NULL (110105)
2. Nanshan District, Shenzhen, Guangdong, China (440305)
3. Futian District, Shenzhen City, Guangdong Province NULL (440303)
4. Nanshan District, Shenzhen City, Guangdong Province 2 NULL (440305)
5. Guangdong Province NULL (440000)
Just learned SQL, please help ... |
|