MySQL Forums
Forum List  »  MyISAM

Re: Location search in mysql joining 4 tables
Posted by: Peter Brawley
Date: January 21, 2017 04:25PM

To join rows across tables, you need to define columns whose values are to match. For example the cities table would need a state column which could be looked up in states, which would have a country column looked up in countries. You've not shown us your table DDL ,so I can only guess ...

select cities.name,state.name,countries.name
from cities
join states on cities.state=state.name
join countries on state.country=countries.name
where cities.address like '%Bourke St%' and cities.name like '%Melbourne%' ;

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Location search in mysql joining 4 tables
1021
January 21, 2017 04:25PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.