Hey everyone,
I have a task to pull a query/report that shows missing dates. I only have the ability to query, I dont have the abiltiy to create stored procedures or temp tables on this system (its a vendors).
I need to find out if there are any missing Dates (Service Dates) from the charges table between the Admit date(which will be the same for every row) and the last charge date(aka..service date).
For example, I would like to know admit date = 9/2/08 last charge date = 9/30/08 – missing dates 9/14 and 9/16….
Hope that makes sense, and if you have any ideas that would be great.
I have a task to pull a query/report that shows missing dates. I only have the ability to query, I dont have the abiltiy to create stored procedures or temp tables on this system (its a vendors).
I need to find out if there are any missing Dates (Service Dates) from the charges table between the Admit date(which will be the same for every row) and the last charge date(aka..service date).
For example, I would like to know admit date = 9/2/08 last charge date = 9/30/08 – missing dates 9/14 and 9/16….
Hope that makes sense, and if you have any ideas that would be great.
Code:
SELECT
A.ACCTCPCODE Site,
A.ACCTCODE Account,
to_date(A.ACCTLOGDATE,'j') Log_Date,
A.ACCTBALANCE Balance,
C.TYPE,
C.PRCODE,
to_date(C.SERVICEDATE,'j') Service_Date,
to_date(C.ADMITDATE,'j') Admit_Date
FROM
ACCOUNT A
JOIN CHARGES C ON ((A.ACCTCPCODE=C.CPCODE)
AND (A.ACCTCODE=C.ACCOUNT)
AND (C.TYPE='C')
AND (C.SPLITFLAG IS NULL))
WHERE
(A.ACCTCPCODE='226002')
AND (A.ACCTCODE='133')
ORDER BY
to_date(C.SERVICEDATE,'j')