HELP WITH MY WHERE CLAUSE REQUIREMENT
Hello ,
I need help with examining this query.
I have this query below and my requirements. The First Requirement is
1. If appselection !=’notice to process’ and notetxt is NULL in last month show acct and no txt notes
2. if appselection=’notice to process’ and no notetxt in one month show the results (acctid)
—————————————————————————————
WITH NOTATION AS (SELECT
acctid,
appselection,
notetxt,xtp,
ndate
FROM TABLEA),
City as (acctid,
appselection
FROM EXAMPLE)
SELECT a.acctid,b.appselection,a.notetxt,a.ndate,a.xtp
FROM NOTATION a
LEFT JOIN b
ON a.acctid=b.acctid
WHERE b.appselection=’notice to process’ AND (a.notetxt IS NULL OR TO_DATE(a.ndate, ‘mm/dd/yyyy’)<=ADD_Months(SYSDATE,-1))) OR b.appselection=’notice to process’ AND (a.notetxt IS NULL OR TO_DATE(a.ndate,’mm/dd/yyyy’)<=ADD_MONTHS(sysdaate,-1)))
————————————————————————————-
I need another Where clause for requirement 2 using the same query above
REQUIREMENT b: show acctid with no notetxt in Last 2 weeks. below is what I have
WHERE n.notetxt IS NULL AND TO_DATE(n.ndate, ‘mm/dd/yyyy’)<=CURREN_DATE-14)
Hello ,I need help with examining this query.I have this query below and my requirements. The First Requirement is1. If appselection !=’notice to process’ and notetxt is NULL in last month show acct and no txt notes2. if appselection=’notice to process’ and no notetxt in one month show the results (acctid)—————————————————————————————WITH NOTATION AS (SELECTacctid,appselection,notetxt,xtp,ndateFROM TABLEA),City as (acctid,appselectionFROM EXAMPLE)SELECT a.acctid,b.appselection,a.notetxt,a.ndate,a.xtpFROM NOTATION aLEFT JOIN bON a.acctid=b.acctidWHERE b.appselection=’notice to process’ AND (a.notetxt IS NULL OR TO_DATE(a.ndate, ‘mm/dd/yyyy’)<=ADD_Months(SYSDATE,-1))) OR b.appselection=’notice to process’ AND (a.notetxt IS NULL OR TO_DATE(a.ndate,’mm/dd/yyyy’)<=ADD_MONTHS(sysdaate,-1)))————————————————————————————-I need another Where clause for requirement 2 using the same query aboveREQUIREMENT b: show acctid with no notetxt in Last 2 weeks. below is what I haveWHERE n.notetxt IS NULL AND TO_DATE(n.ndate, ‘mm/dd/yyyy’)<=CURREN_DATE-14) Read More