I have tables: users, sounds, votes.
- users hasmany votes
- sounds hasmany votes
- votes has fields: id, user_id, sound_id

This setup gives me the ability to have users vote for sounds, and to
keep the info about who voted for what (though maybe this is not a
good way to do it, if so, please correct me).
I want a query that gives me a list of sounds, ordered by the number
of votes (so the number of occurences of the sound_id in the votes-
table).
How do I make the query?
What I have so far is $this->Sound->find('all',aa('limit',10,'order',a
('Vote.sound_id')));
The part in 'order' is wrong, and I have no idea how to adapt it, can
someone shed some light on this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to