0

My database tables

zones [ id zone zone_manager_email]

cities [ id city zone_id ]

store[id name store_no city_id]

I have these 3 tables, I tried to inner join them , but my code is not working.

 SELECT zones.zone, zones.zone_manager_email,store.store_id
 FROM zones,store
 INNER JOIN zones on zones.id = cities.zone_id
 INNER JOIN store ON store.city_id = city.id
Shadow
  • 33,525
  • 10
  • 51
  • 64
Vijith Vs
  • 29
  • 5

1 Answers1

0

First you never really reference the cities table, then you seem a bit consfused over the difference between different ways of doing this.

from a, b WHERE a.col1 = b.col1 vs from a inner join b on a.cool1 = b.col1.

Try this one :).

SELECT zones.zone, zones.zone_manager_email,store.store_id
FROM zones
INNER JOIN cities ON zones.id = cities.zone_id
INNER JOIN store ON store.city_id = city.id
user1694674
  • 101
  • 5