Let’s say you have a store table in your database and you want to get the first letter of each store’s name. So you can create a menu by first letter of each store name and not having a letter that contains no stores.
1 2 3 4 5
$stores = $this->Store->find('all',array( 'order'=>'name ASC',
'fields'=>'DISTINCT(UPPER(LEFT(name,1))) AS letter',
'conditions'=>array("UPPER(LEFT(name,1)) REGEXP '[A-Z]'")));
