I have two tables and two queries for each table
A query is
SELECT DISTINCT CodContrato, FechaBaja, FechaFin
FROM Contrato
WHERE (FechaBaja != FechaFin)
AND (FechaBaja BETWEEN '20180101 00:00:00' AND '20181231 23:59:59')
and the other one
SELECT DISTINCT FechaFinProrroga
FROM DatoAuxiliarContrato
WHERE (FechaFinProrroga != '') AND (FechaFinProrroga BETWEEN '20180101 00:00:00' AND '20181231 23:59:59')
Both tables have a common data that is CodContrato
I need to make a query that unifies both querys, that is,
SELECT DISTINCT CodContrato, FechaBaja, FechaFin, FechaFinProrroga
FROM Contrato, DatoAuxiliarContrato
WHERE ((FechaBaja != FechaFin)
OR (FechaBaja != FechaFinProrroga))
AND (FechaBaja BETWEEN '20180101 00:00:00' AND '20181231 23:59:59')
Obviously this last one does not work, but it is for you to see what I want and I do not know how to do it Thanks in advance