Simple, I want combine results when using WHERE LIKE in multiple columns
$query = "SELECT T.Id_Servicio ids,
C.Nombre cliente,
T.T_Atencion atencion,
M.Nombre marca,
P.Nombre producto,
SU.Nombre subproducto,
T.Observaciones obs,
T.Estado edo
FROM t_servicio T
INNER JOIN cat_clientes C ON C.Id = T.Id_Cliente
INNER JOIN cat_marcas M ON M.Id = T.Marca
INNER JOIN cat_productos P ON P.Id = T.Producto
INNER JOIN cat_subproducto SU ON SU.Id = T.SubProducto
WHERE C.Nombre LIKE '%$termsearch%'
OR T.T_Atencion LIKE '%$termsearch%'
OR M.Nombre LIKE '%$termsearch%'
OR P.Nombre LIKE '%$termsearch%'
OR SU.Nombre LIKE '%$termsearch%'";
With this instruction, take last results but doesn’t combine all results, which would be the correct statement?
I hope can help me please!
Using
INNER JOINyou will only match those row that are related.If I get you right, simple switching to
LEFT JOINwill make you happier.You also may need to have a
GROUP BYstatement in the end.