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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.