Sunday, 25 June 2017

72.count in select query

$select   =   $table->select()
                        ->setIntegrityCheck(false)
                        ->from(array('user'=>'engine4_users',))
                        ->columns(array('count_property' => new Zend_Db_Expr('COUNT(user.user_id)')))                      
                        ->joinLeft(array('search_field'=>'engine4_user_fields_search'),'search_field.item_id=user.user_id',null)                                            
                        ->joinLeft(array('plist'=>'engine4_property_list',),'plist.property_owner_id=user.user_id')                                
                        ->where('user.search=?' , 1)
                        ->where('search_field.profile_type =?' , '4')
                        ->group('user.user_id');

No comments:

Post a Comment