Show Menu
Cheatography

Zend Db Select Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Select method

$query = $adapter->select();

from method

$query->from(
    'table', 
    ['alias' =>'column'],
     'schema'
);

Group

$query->group('colum');
$query->group(['colum1', 'column2']);

Expres­sions

$query->from('table', new \Zend_Db_Expr('count(*)')); //This will make the query parser insert the expression as is, without any modifications.

join

$query->join(array('alias' => 'table'),
                    'alias.product_id = other_alias.product_id',
                    array('alias_column'=>'column') ); 
$query->joinRight();//Same parameters for all below
$query-> joinLeft();
$query-> joinFull();
$query-> joinCross();
$query->joinNatural(table, [columns]); //dont need condition parameter (2nd parameter)