Here is my code I am working on:
Here is some background...I am looking at finding scheduled clients who have appointments in the future with a code of 'reentrmr30'. Of these people who have an appointment for a 'reentrmr30', how many do not have a flag of 'b' AND have not had a 'ev60' in the past year.
So my results need return results where there no EV60 at all. I'm not sure how to search for something that does not exist in a table! Thanks, for all help!
wfd1bdb
SELECT ACCOUNT, BOOK, REASON, USERFLAG, adate as test
FROM MWAPPTS
WHERE (ADATE < GETDATE()) AND (ADATE > GETDATE() - 365) AND (USERFLAG <> 'b') AND (REASON = 'ev60') AND (ACCOUNT IN
(SELECT DISTINCT account
FROM mwappts
WHERE adate >= getdate() AND reason = ('reentrmr30')and userflag ='u'))
ORDER BY adate desc, account
Here is some background...I am looking at finding scheduled clients who have appointments in the future with a code of 'reentrmr30'. Of these people who have an appointment for a 'reentrmr30', how many do not have a flag of 'b' AND have not had a 'ev60' in the past year.
So my results need return results where there no EV60 at all. I'm not sure how to search for something that does not exist in a table! Thanks, for all help!
wfd1bdb
SELECT ACCOUNT, BOOK, REASON, USERFLAG, adate as test
FROM MWAPPTS
WHERE (ADATE < GETDATE()) AND (ADATE > GETDATE() - 365) AND (USERFLAG <> 'b') AND (REASON = 'ev60') AND (ACCOUNT IN
(SELECT DISTINCT account
FROM mwappts
WHERE adate >= getdate() AND reason = ('reentrmr30')and userflag ='u'))
ORDER BY adate desc, account