I have been working on this SQL statement for quite a long time and I am not sure where the issue is. If you could point me in the right direction, I would appreciate it.
I can write it like this and it returns records between two dates. From this query, I have confirmed that there are records for the Dummy company name within those dates.
Code: Select all
SELECT records.CompanyName, negotiations.CaseNumber, negotiations.DateAgreement
FROM records
RIGHT JOIN negotiations ON records.CaseNumber = negotiations.CaseNumber
WHERE negotiations.DateAgreement
BETWEEN '2000-01-01'
AND '2020-01-01'
ORDER BY negotiations.CaseNumber DESC
Code: Select all
SELECT records.CompanyName, negotiations.CaseNumber, negotiations.DateAgreement
FROM records
RIGHT JOIN negotiations ON records.CaseNumber = negotiations.CaseNumber
WHERE records.CompanyName = 'Dummy'
ORDER BY negotiations.CaseNumber DESC
Code: Select all
SELECT records.CompanyName, negotiations.CaseNumber, negotiations.DateAgreement
FROM records
RIGHT JOIN negotiations ON records.CaseNumber = negotiations.CaseNumber
WHERE negotiations.DateAgreement
BETWEEN '2000-01-01'
AND '2020-01-01'
AND records.CompanyName = 'Dummy'
ORDER BY negotiations.CaseNumber DESC