I am trying do a remote filtering of a data grid.
The grid has a textfield, where the user enters chars which are sent to the server to refresh the grid.
My problem is that I am using Propel to work with the database and I need concat two MySQL fields to do the comparison. I don't know how do a simple where concat(firstname, ',', lastname) like '%aText%'
in Propel.
I've tried:
$usuarios = UsuariosQuery::create()
->where("(concat(usuarios.apellido,' , ',usuarios.nombre)) LIKE '%?%'",$filter)
->orderByApellido('ASC')
->find();
This doesn't work. How can I get this to work?
Try this according to the doc (search for concat
):
$usuarios = UsuariosQuery::create()
->where('CONCAT(Usuarios.Apellido, ",", Usuarios.Nombre) LIKE ?', $filter)
->orderByApellido('ASC')
->find();
}}}