Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Group By in Cakephp

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 2.00k
    Comment on it

    The GROUP BY statement is used in conjunction with the aggregate functions to group the result-set by one or more columns.

    Below is the possible keys that we use in cakephp query.

    $params = 
            array(
            'conditions' => array('Model.field' => $thisValue), //array of conditions
            'recursive' => 1, //int
            //array of field names
            'fields' => array('Model.field1', 'DISTINCT Model.field2'),
            //string or array defining order
            'order' => array('Model.created', 'Model.field3 DESC'),
            'group' => array('Model.field'), //fields to GROUP BY
            'joins' => array('Join relations here'), // for ex: LEFT JOIN `entities` AS Entity ON `Entity`.`category_id` = `Category`.`id`
            'limit' => n, //int
            'page' => n, //int
            'offset' => n, //int
            'callbacks' => true //other possible values are false, 'before', 'after'
        );
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: