Reputation: 11787
If I have two tables:
Temp Snow
-------- -------------
School School Skip
-------- -------------
School 1 School 1 1
School 2 School 4 0
School 3 School 3 1
And I want to see if a 0
is present in the Skip
column of table Snow
, is it possible to just in the rows that contain the same School
value? In this case, it would just search for a 0
in the School 3
and School 1
rows, because the School
name matches up with the one from Temp
.
Currently, I am using the following, but it's including every row:
SELECT Skip FROM Snow WHERE Skip = 0
Upvotes: 1
Views: 67
Reputation: 263913
You just need to join both tables. As you can see there are letters after the table names. They are called ALIAS
es (nickname) of the tables.
SELECT a.School
FROM Snow a
INNER JOIN Temp b
ON a.School = b.School
WHERE a.skip = 0
Upvotes: 2