ive got a mysql database that has 4 tables.
Location, City, State and Country
Im trying to do a list all of Locations via the following:
SELECT Locations.Street, City.CityName, State.StateName, Locations.PhoneNumber, Country.CountryName FROM Locations, City, State, Country WHERE Locations.CityID=City.CityID AND City.StateID=State.StateID AND State.CountryID=Country.CountryID
Basically Locations looks like:
+-------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------+------+-----+---------+----------------+
| LocationID | int(11) | | PRI | NULL | auto_increment |
| Street | text | | | | |
| CityID | int(11) | | | 0 | |
| PhoneNumber | text | | | | |
| Email | text | | | | |
+-------------+---------+------+-----+---------+----------------+
City is:
+----------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+---------+------+-----+---------+----------------+
| CityID | int(11) | | PRI | NULL | auto_increment |
| CityName | text | | | | |
| StateID | int(11) | | | 0 | |
+----------+---------+------+-----+---------+----------------+
State is:
+-----------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+---------+------+-----+---------+----------------+
| StateID | int(11) | | PRI | NULL | auto_increment |
| StateName | text | | | | |
| CountryID | int(11) | | | 0 | |
+-----------+---------+------+-----+---------+----------------+
and country:
+-------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------+------+-----+---------+----------------+
| CountryID | int(11) | | PRI | NULL | auto_increment |
| CountryName | text | | | | |
+-------------+---------+------+-----+---------+----------------+
Anyone know what im doing wrong with my select statement?