Home  >  Article  >  Database  >  数据库-关于原生mysql语句多表查询更新字段问题 求大神解答

数据库-关于原生mysql语句多表查询更新字段问题 求大神解答

WBOY
WBOYOriginal
2016-06-06 09:43:181122browse

mysql数据库

如题:
a表
user_id school_id
1233 22013
2346 22017
2344 23445
2247 22017
... ...

b表
user_id term
2346 1
2346 1
2346 2
2247 2
1233 1
... ...

如上两张表:
根据a表中的school_id=22017 得到它的user_id 然后根据此user_id得到b表中的term

并把term=1的变为term=2,把term=2的变为term=1

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn