distinct with php and datatables

distinct with php and datatables

masscrxmasscrx Posts: 2Questions: 0Answers: 0
edited January 2014 in General
Hi,
I have working datatables on my site, for server-side processing I'm using this code (cakephp 2.x):
[code]
$this->paginate = array(
'fields' => array(
'Item.item_id', 'Item.name', 'Item.properties', 'Item.purchasePrice', 'Item.salePrice', 'Item.serialNumber'),
'link' => array(
'Producer' => array(
'fields' => array('name')
),
'Category' => array(
'fields' => array('name')
),
'Supplier' => array(
'fields' => array('name')
)
)
);

$this->DataTable->fields = array('Item.item_id', 'Item.name', 'Item.properties', 'Item.purchasePrice', 'Item.salePrice',
'Item.serialNumber', 'Category.name');
$this->DataTable->emptyElements = 1;
$this->set('items', $this->DataTable->getResponse());
$this->set('_serialize','items');
[/code]

But how to make distinct query with it ?

Replies

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    Presumably getResponse() is querying a database? Can you not add the DISTINCT keyword to that query?
This discussion has been closed.