tags:

views:

34

answers:

1

How do I get to make this sqsl query work:

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. Because the usual example in w3schools doesn't include a where statement. Please help.

+3  A: 

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" 
astander
Thanks, but How do I skip the NULLS sir?
@user225269: If you omit the "RIGHT" in "RIGHT JOIN", then many nulls will go away ..
lexu
thanks for that