Home > Database > Mysql Tutorial > body text

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

WBOY
Release: 2016-06-06 09:43:18
Original
1124 people have browsed it

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!