Jump to content
Larry Ullman's Book Forums

Problem Returning Rows Where...


Recommended Posts

Hello everyone,

 

I'm having a slight difficulty getting a query to work. What I'm trying to do is return hotels that have certain features such as "dry cleaning" etc.

 

This query (pseudo code) doesn't work. It returns a message saying: MySQL returned an empty result set (i.e. zero rows). ( Query took 0.0009 sec )

SELECT ... WHERE... f.features_name='dry cleaning' && f.features_name='spa' 

This query returns hotels that have "dry cleaning" and/or "spa". What must I do so only hotels are returned that have both features?

SELECT...WHERE ...f.features_name IN ('dry cleaning', 'spa')

Thank you in advance.

Link to comment
Share on other sites

Hey HartleySan,

 

thank you for your prompt reply. I'm using the intermediary table which contains the hotel_id and the feaures_id, so each hotel will have multiple features. I tried the OR but it returns hotels that have only one of the 2 example features, but I need the hotels that have both features.

 

 

Will try to get it right.

 

 

Thanks. Hope your Monday is off to a good start.

Link to comment
Share on other sites

 Share

×
×
  • Create New...