this LIKE based solution will not use index and thus on a more or less large data set will get mysql down as it requires full table scan.
chris burgess: > Alternative solution (using MySQL-specific GROUP_CONCAT()): > > SELECT Person.id, Person.name, GROUP_CONCAT(city) AS Cities > FROM Person, Address > WHERE Address.belongs_to = Person.id > GROUP BY Person.id > HAVING Cities LIKE '%Wellington%' AND Cities LIKE '%Auckland%' ; > > > > > --~--~---------~--~----~------------~-------~--~----~ NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to [email protected] To unsubscribe, send email to [email protected] -~----------~----~----~----~------~----~------~--~---
