I want to use a sql function or perform calculations in a statement I'm generating with zend_db_select. How can I do this?



I want to use a sql function or perform calculations in a statement I'm generating with zend_db..

Answer / Gaurav Kumar Agarwal

Zend Framework provides a way to include SQL functions and calculations in your statements using the `ZendDbSqlExpression` class. Here's an example:
1. Create an instance of Expression: `$expression = new ZendDbSqlExpression('SUM(column_name)');`
2. Add the expression to your Select object: `$select->columns(['total' => $expression]);`

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Zend Interview Questions

Explain form element decorators in zend framework2?

1 Answers  


What should I know about the zend framework cla before submitting it?

1 Answers  


Which version of php does zend framework require?

1 Answers  


What new in zend framework 2.0?

1 Answers  


How to display zend_form_element_radio on one line ?

1 Answers  


What is a module in zend framework 2?

1 Answers  


How to redirect to another page from controller?

1 Answers  


How to print exact sql query in zend framework ?

1 Answers  


Explain how routing works?

1 Answers  


What is autoloader?

1 Answers  


Difference between javascript ajax request vs jquery $.ajax?

1 Answers  


What are plugins in the zend framework?

1 Answers  


Categories