简体   繁体   English

在mysql中联接表的正确方法是什么

[英]What's the proper way of joining tables in mysql

How do I get to make this sqsl query work: 我如何使这个sqsl查询工作:

SELECT student.LASTNAME,
       student.FIRSTNAME,
       student.IDNO,
       student.YEAR,
       parents.P_ADDRESS
FROM student
WHERE P_ADDRESS="Ambagat, Santol, LU"
RIGHT JOIN parents ON student.IDNO = parents.IDNO

I just want to add where statement on the joins. 我只想在联接上添加where语句。 Because the usual example in w3schools doesn't include a where statement. 因为在w3schools中,通常的示例不包含where语句。 Please help. 请帮忙。

Like this 像这样

SELECT  student.LASTNAME, 
        student.FIRSTNAME, 
        student.IDNO, 
        student.YEAR, 
        parents.P_ADDRESS 
FROM    student RIGHT JOIN parents  ON  student.IDNO=parents.IDNO 
                                    AND P_ADDRESS="Ambagat, Santol, LU" 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM