Pueden ayudarme a mejorar. este codigo? es para crear un procedimiento. pero no me gusta como ha quedado.
- Code: Select all Expand view
- BEGIN
SET @cCampo = cCampo ;
SET @cCadena = cCadena ;
SET @cSelect =
CONCAT( "
select
a.id AS c1,
a.nombre as c2,
a.habilitado as c3,
b.id as c4,
b.id_cliente as c5,
b.telefono as c6
FROM tbclientes AS a
Left join tbdatos as b
ON b.id_cliente = a.id
ORDER BY a.nombre DESC ",
"WHERE ",
@cCampo,
" LIKE '%",
@cCadena, "%'" ) ;
PREPARE stmt FROM @cSelect ;
execute stmt ;
deallocate prepare stmt ;
END