This is the query I want to make: -- Obtain the name, telephone number, comments and duration of the visit of the visitors Lorea and Ramón.
SELECT vi.Nombre, vi.NO_Móvil, ci.Duración, re.Observaciones
FROM Visitante vi
JOIN Citaprevia ci ON vi.DNI=ci.fk_DNI
JOIN Registrovisita re ON re.fk_Cod_Visita=ci.Cod_Visita
WHERE ci.Cod_Visita='1' AND ci.Cod_Visita='2';
It doesn't give me an error, it just returns an empty response. When I remove the AND from the WHERE condition and the second, condition gives me the first answer (which is related to Lorea).
Thank you very much
AND and OR operators are used to filter results with 2 conditions.
The AND operator will display the results when the 2 conditions are met.
Condition1 AND condition2
The OR operator will display the results when either of the 2 conditions is met.
Condition1 OR condition2