mysql数据库三表查询

这样写:SELECT S.SName AS 姓名, CS.CourseName AS 课程, C.Score AS 成绩 FROM Students AS S INNER JOIN Score AS C ON (S.SCode = C.StudentID) INNER JOIN Course AS CS ON (CS.CourseID = C.CourseID 扩展资料:SQL联

select a.*, b.*, c.* from tablea as aleft join tableb as b on a.xx = b.xxleft join tableb as c on b.xx = c.xx

select PWD,GH,QX from student where GH = '特定值';

select * from xs a join xs_kc b on a.xsld=b.xsld join kc c on b.kcld=c.kcld

select *from travelerinfo t1 left join tickorderinfo t2 on t1.orderId=t2.orderId left join pnrauth t3 on t2.tickOrderId=t3.tickOrderIdwhere t2.status=28 and t3.authPCC='ABC'order by t1.orderidlimit 1000

使用UNION联合两个语句即可:select * from a where cid=1 UNION select * from b where cid=1

select * from table1 a,table2 b,table3 c where a.1id = b.1id inner join a.1id = c.2id;

select * from (select join on 两个表连接) a join 第三个表 on

快速查询的使用连接查询,但是表之间需要有关系,left,right,inner查询,代码方便的使用where a.x=b.x 诸如此类的

这个表设计的肯定不太合理的,表与表之间要有关联才好查询的,用join 或select * from a,b,c where a.id=b.id and a.id=c.id and c.id=b.id

相关文档

mysql学生表三表查询
mysql三张表关联查询
mysql三表连接查询
mysql三表联查的sql语句
三表查询sql语句怎么查
mysql 三表关联查询
三表联合查询sql语句
两表连接查询mysql语句
jtlm.net
zxqk.net
ntjm.net
mwfd.net
gpfd.net
电脑版