I got two tables with the same pk (idnumber).. I want to select all column from table1 where idnumber (table1’s pk) is equal to idnumber (table2’s pk where table2’s column = “some value”..)
please help… thank you
Here’s what I got so far..
SELECT
idnumber, fname, lname, mname, bday, gender, email, contact
FROM
tblStudents
WHERE
(idnumber = (SELECT idnumber
FROM tblPayments
WHERE (payment1 = 0)))
It’s not working…
I’m totally new to SQL Server.. just got started few days ago.. please help..
Assuming both tables share a common column, you can just perform an
INNER JOINand use theWHEREclause to perform additional filtering.SQL Join Fundamentals (2005)
I think the specific query you are looking for is: