I am using MySQL and have the following SQL tables
Table1
id | var1 | var2 | var3
Table2
id | var4 | var5
I run the Query
SELECT id, var1 from Table1 where var3 = X
This will return multiple values.
I then want to
SELECT var4 from Table2 where id = Y
for each of the ids that have been returned from the first query.
What is the best way to approach this? Can it be done in 1 statement?
EDIT:
To clarify I also need var1 from Table1 to be returned as per the first Query above.