In simple sql query we concat two fields by using concat keyword
SELECT CONCAT( `firstname` , ' ', `lastname` ) AS fullname
FROM user
But in cakephp we can do this by using 'virtualFields'
class User extends AppModel {
public $virtualFields = array(
'fullname' => 'CONCAT(firstname, " ", lastname)'
);
}
0 Comment(s)