Results 1 to 2 of 2
Feb 28, 2014, 07:07 #1
- Join Date
- Jul 2013
- South of the equator, then turn left
- 0 Post(s)
- 0 Thread(s)
Problem joining tables with same ID
I've started a thread in the databases & mysql forum:
I am using a "lookup table" which means the same ID might appear multiple times in the table. Now the problem is that the data I'm returning loops out multiple times because of that ID.
This is the structure of the query. If the hotels_features table has the same hotel id appearing 5 times, the rooms will loop out 5 times as well.
$q = "SELECT column names FROM hotels AS h INNER JOIN rooms AS r ON r.hotel_id=h.hotel_id INNER JOIN hotels_features AS hf ON hf.hotel_id = h.hotel_id INNER JOIN features AS f ON f.features_id = hf.features_id ...WHERE category = '$category'";
Perhaps someone will know where the problem lies.
Thank you in advance.