A query to sum the values and select all fields according to the "where" and "or" clause with the like operator

0

In cakephp, I want to make a query that takes all the values according to the parameter passed to the expense field or to the field data_expenditure, in addition to summing the values of the field_expenditure value. It would look something like this:

$this->Despesa->query("select sum(valor_despesa) select from despesas where despesa like '%escola%' or data_despesa like '%2015%'");  

I only managed to solve two querys. One to find and add and the other to find all the columns of the table according to the parameters passed. I want everything, if possible, in a single query.

    
asked by anonymous 23.10.2015 / 03:25

0 answers