I'm having a bizarre problem with MySQL; I can't see what I've done wrong. AFAIK, I'm following the MySQL manual perfectly.
First of all, here's the structure of the two tables:
accommodation
uid
label
etc.
amenity
uid
label
etc.
and a join table:
accommodationToAmenity
accommodationID
amenityID
Basically, I have a multiple-to-multiple relationship between 'accommodation' (a list of houses available for rent) and 'amenity' (a list of amenities and features such as hot tub, fireplace, patio, pet-friendly, etc.)
So, being rather ignorant of the 'JOIN' keyword in MySQL, I decided to use this query:
SELECT * FROM amenity WHERE uid IN (
SELECT amenityID FROM accommodationToAmenity WHERE accommodationID =1
)
This should grab the list of amenityIDs from the join table (for accommodationID = 1) and use that as a list for comparing against the primary key (uid) in the amenity table, right?
Wrong! it tells me that there's a syntax error near the subquery. Here's the exact output:
#1064 - You have an error in your SQL syntax.
Check the manual that corresponds to your MySQL server
version for the right syntax to use near
'SELECT amenityID
FROM accommodationToAmenity
WHERE accommodatio
any ideas? am I completely off-course here?