赞
踩
参考了一位博主的博客,记录一下以后好找。
用inner join链接三个表
> select * from (表A inner join 表B on A.字段名 = B.字段名) inner join 表C on A.字段名 = C.字段名;
Exp:
有三个表:(黄色列为biology表,蓝色列为physics表,粉色列为chinese表)
修改*改为
> select chinese.No, biology.Name, biology.teacher, physics.teacher, chinese.teacher from (biology inner join physics on biology.b_No = physics.p_No) inner join chinese on biology.b_No = chinese.No;
结果如下:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。