Reputation: 1388
I have an id in table x representing a state in another table.
For instance.
Table x has a state id of 1 and that id of 1 in table z represents a state.
How would I loop through this in php and mysql to display the value of that id from table z?
Upvotes: 0
Views: 60
Reputation: 1918
same solution, simplier notation is
select z.id
from tablex x,
tablez z
where x.id = z.id
Upvotes: 0
Reputation: 5740
An INNER JOIN
to make sure it connects.
SELECT z.id FROM x INNER JOIN z ON (x.id = z.x_id)
Upvotes: 1