Jump to content

Selecting all data from multiple SQL tables... Quick FIX


wispas

Recommended Posts

I have 3 tables which i want to combine and select with one query...

 

Tables: city, hotel, gallery

 

I currently have:

SELECT * FROM city
INNER JOIN hotel
ON hotel.hotel_city_code = city.city_code
WHERE city_id=1

 

This will join the hotel and city together perfectly allowing me to select all of the data from hotel and city with the matching city code, but i want to also join the gallery table as well in the same query and have its city code match the city city code and am getting syntax errors... Heres what i have tried and still working on:

 

SELECT * FROM city
INNER JOIN hotel, gallery
ON hotel.hotel_city_code = city.city_code
AND gallery.gallery_city_code = city.city_code
WHERE city_id=1

 

Anyone can provide me with a quick fix? Cheers!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.