MySQL Forums
Forum List  »  Newbie

Re: SQL query to return all matching condition
Posted by: Faheem Hameed
Date: July 06, 2005 08:03PM

Hi Roland,

Your query did work.

===============================================================
SELECT DISTINCT a.*
FROM shelter a
INNER JOIN (
SELECT c.serial_shelter
FROM shelter_location c
WHERE c.Location_Category
IN (
'Cake shop', 'Other Store'
)
GROUP BY c.serial_shelter
HAVING count( DISTINCT c.location_category ) = 2
) s
ON a.Shelter_Code = s.serial_shelter
===============================================================

I do not understand why my previous query did not work. May be it is a mysql bug as Felix noted.

Any way thanks for all of your replies. I love this forum that I can get quick & useful help. I think I can hone my mysql skills quickly here.

Hameed

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.