SQL语句有关问题,关联查询,一对多

WBOY
Release: 2016-06-13 12:09:04
Original
1135 people have browsed it

SQL语句问题,关联查询,一对多
比如老师和学生表,一个老师对应多个学生。想查出来老师A和他对应的学生1,2,3,老师B和他对应的4,5,6.
------解决思路----------------------

<br /><br />select * from 学生表 a,教师表 b,教师学生关系表 c where a.studentid = c.studentid and b.teacherid = teacherid and b.teacherid = 你要查的老师id<br /><br />
Copy after login

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