Here is one of the best ways to solve your parameterization problem. Your updated answer solved my problem, but then I did it better with parameterized.
$case = 'CASE ';
$sqlCase = $this->getAdapter();
$case .= $sqlCase->quoteInto('WHEN col_1 = 1 THEN ? ', yourVariable, Zend_Db::INT_TYPE);
$case .= $sqlCase->quoteInto('WHEN col_2 = 1 THEN ? ', yourVariable, Zend_Db::INT_TYPE);
$case .= $sqlCase->quoteInto('WHEN col_2 = 1 THEN ? ', yourVariable, Zend_Db::INT_TYPE);
$case .= 'ELSE 0 END ';
- . $case
, . $case
- ? Zend_Db_Expr
String
.
$select =$this->getAdapter();
$select->columns(array(
'user_name',
'group_id',
'merge_col' => new Zend_Db_Expr($case)))
->where (array('group_id'=> 10))
->order ('merge_col');