It is assumed that this query has to filter for all the conditions that are after the where
or combine the conditions but, when I put a date range, a name and an interaction title, the data does not they filter as they should.
SELECT DISTINCT cl.first_name as Nombre, cl.last_name as apellido,cl.id_personal as Cedula, cl.phone as phone,it.title as interacion, fecha
FROM (SELECT interactions.create_date as fecha FROM interactions WHERE interactions.create_date BETWEEN '2017-10-23' AND '2017-10-23') sa, clients_profile cl left join interactions it ON cl.id = it.id_client_profile
WHERE cl.first_name = '' OR
cl.last_name = '' OR
cl.phone = '' OR
cl.id_personal ='' OR
it.title = '';
This is an example of the result that I get when trying to filter by the 2 fields, what you happen is that I seek to obtain a query where you filter the data through the parameters and if you do not send one that filters by at least 1, in this case would be the dates