Robot HABTM Tag User hasMany Robot Robot belongsTo User I want to get related robots based on his tags. More tags in common, more related.
So, whats the way to put this query using $this->Robot->find(...) or $this->Robot->RobotsTag->find(...) SELECT count(tag_id) as total, Robots.*, Users.username FROM (`robots_tags` INNER JOIN robots ON (robots_tags.robot_id = robots.id)) INNER JOIN users ON robots.user_id=users.id WHERE tag_id IN (1,2,3) GROUP BY robot_id ORDER BY total DESC LIMIT 4 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
