wispas Posted January 29, 2010 Share Posted January 29, 2010 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 https://forums.phpfreaks.com/topic/190240-selecting-all-data-from-multiple-sql-tables-quick-fix/ Share on other sites More sharing options...
wispas Posted January 29, 2010 Author Share Posted January 29, 2010 no worries... i figured it out... SELECT * FROM city INNER JOIN hotel, gallery WHERE hotel.hotel_city_code = city.city_code AND gallery.gallery_city_code = city.city_code AND city_id =1 Link to comment https://forums.phpfreaks.com/topic/190240-selecting-all-data-from-multiple-sql-tables-quick-fix/#findComment-1003706 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.