Re: Model: Query distinct values from a table then save those values to another table

2011-12-09 Thread Geoff Douglas
$distinctBookCategories = $this->Book->find('list',array( 'fields'=>array('category_id'), 'conditions'=>array( 'NOT'=>array('category_id'=>null), '{Other book conditions go here}' ), 'group'=>'category_id' )); I am not sure what you are looking to do here. But this is the code I use to pull un

Model: Query distinct values from a table then save those values to another table

2011-12-09 Thread Typezero
Hi guys, CakePHP noob here. Just wanted to ask how can you query distinct values from a table then save it on another? Say I have a table for books, certainly some of them are classified into a common category like fiction or history. Now I created another table just to reference their distinct