1 answer
0 votes
Paginate doesn't show distinct id
Hello,
I have a problem with paginate. Instead of showing distinct id's it duplicate the number of rows. For example if in my database exists only 1 record, paginate brings me 3 identical records.
Can someone help me?
I use cakephp 1.2.5
1 answer
0 votes
Finding the latest post for each user
How do I construct a find that returns a limit of 1 'post', the latest 'publish date', for each 'user'? I suspect a condition with DISTINCT but I can't seem to figure it out.
1 answer
0 votes
Find all with a distinct field
Hi,
when i use distinct and wan't to select all fields, i must write them down all in the fields array
example:
$this->controller->find('all', array('fields' => array('DISTINCT field1', 'field2', 'field3' ...... 'field n')));
This is pretty...
1 answer
0 votes
iterate and echo array elements
Hi,
I have an in dex method with a find to select all distinct user id's in my user table;
$userId = $this-Order-find('all', array('fields'=array('DISTINCT(Order.user_id) AS user')));
which sends back the lovely array:
[userId] = Array([0] =...