select *
from tblpatientrecords
where consentdate >= appointdate
AND consentdate <= DATEADD(d, -366, closingdate)
Therefore there are effectively 3 different dates that the table stores,
startingdate, appointdate, and closingdate.
I need to show all the info in the table based on records that the
consentdate is on/after the appointdate, and they also have to be records all
records where the consentdateis within 1 year of the closingdate.
> Please provide table structure, inserts for sample data and expected
> results. It is not clear from your notes what you really need.
[quoted text clipped - 3 lines]
> Plamen Ratchev
> http://www.SQLStudio.com
Plamen Ratchev - 03 Jul 2008 14:03 GMT
What do you get when you run the code you posted? Does it return the result
set you expect?
Perhaps you need this:
SELECT consentdate, appointdate, closingdate
FROM tblpatientrecords
WHERE consentdate >= appointdate
AND consentdate <= DATEADD(YEAR, 1, closingdate);
If not then please post sample data and expected results.
HTH,
Plamen Ratchev
http://www.SQLStudio.com