Hi guys.
A model problem. I am sort of doing the query backwards but I do have a
reason for it... If I can get the query to work I wont have to rework
the data-structure before sending it to the View. (This one query is a
special case and I would like the returned data to match what the View
is expecting.)
Post belongs to User
User hasMany Post
I want to find a bunch of Posts (from the PostController) ordered in
some way but only one per User. I want to sort of have the User.id be
"DISTINCT" but cant get that rare piece of SQL to return any useful
data.
$ret = $this->Post->findAll('','DISTINCT User.id');
This basic query I have so far returns only the ids of the Users... no
other data. I have been trying to read up on MySQL docs but I don't
realy get how to make get the ful result while still limiting to unique
Users.
many thanks i advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Cake PHP" 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
-~----------~----~----~----~------~----~------~--~---