I am performing the following query in a Database:
SELECT t1.uid, t2.mail, t3.field_nombres_value, t4.field_apellidos_value, t5.field_telefono_value, t6.field_celular_value, t7.field_origen_registro_value
FROM users_roles t1
LEFT JOIN users t2 ON t1.uid = t2.uid
LEFT JOIN field_data_field_nombres t3 ON t2.uid = t3.entity_id
LEFT JOIN field_data_field_apellidos t4 ON t3.entity_id = t4.entity_id
LEFT JOIN field_data_field_telefono t5 ON t4.entity_id = t5.entity_id
LEFT JOIN field_data_field_celular t6 ON t5.entity_id = t6.entity_id
LEFT JOIN field_data_field_origen_registro t7 ON t6.entity_id = t7.entity_id
WHERE t1.rid IN (5, 8, 11, 14) AND t5.field_telefono_value IS NOT NULL
Which gives me the data of the users, except those that have NULL
in the telephone field.
I need to bring all the records except those that have NULL in the telephone field or in the cell phone field, there are records that only have one of the fields and I am interested in displaying those records.
How do I validate that?
In
WHERE
it you must add the condition as you pose it using logical operators: