Questions tagged with distinct

1 answer

0 votes

Asked by andreibogdan, on 6/5/10 in

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

Asked by fly2279, on 28/4/10 in

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

Asked by mukki182, on 29/3/10 in

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

Asked by jamesl, on 8/2/10 in

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] =...

<< previous next >>