这条sql语句改怎么写

MySql 码拜 7年前 (2017-04-27) 1332次浏览
小弟不才,刚开始学sql语句,有一事相求。
表结构如草图所示:
这条sql语句改怎么写
本人想通过User表的UserID获取章节表中对应的信息,正确的sql语句改怎么写呢这条sql语句改怎么写
解决方案

5

select *
from 章节表 a, 课程表 b, User表 c
where a.curseid=b.curseid and b.userid=c.userid
and c.userid=xxxxx
i当然,原因是你用userid, 课程表中本来就有,所以两个表其实也够了
select *
from 章节表 a, 课程表 b
where a.curseid=b.curseid
and b.userid=xxxxx

5

select b.*
from 课程表 a inner join 章节表 b on a.CourseID=b.CourseID
where UserID="Ctony_"

5

select b.* from 课程表 a join 章节表 b using (courseid) where userid=”此处输入你要查询的UserID”

5

sele t  * from 章节表 where 章节表.CourseID=课程表.CourseID  and  课程表.UserID = User表.UserID ;

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明这条sql语句改怎么写
喜欢 (0)
[1034331897@qq.com]
分享 (0)