Forum Discussion
mjsystemss
Sep 14, 2024Copper Contributor
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...
rodgerkong
Sep 15, 2024Iron Contributor
Do you need two different result set? With requirement 1, show acct and notetext. With requirement 2, show acctid.
In your SQL sample, WHERE clause has two same parts of conditions that split by 'OR', what is the purpose?
Give some sample rows and show the result your want, will supply more help to understand your question.
In your SQL sample, WHERE clause has two same parts of conditions that split by 'OR', what is the purpose?
Give some sample rows and show the result your want, will supply more help to understand your question.
mjsystemss
Sep 16, 2024Copper Contributor
No. I need One result set. Show account acctid that meets each requirement.
I used OR to indicate that if condition 1 is met show acctid, if condition 2 is met show acctid. Both conditions must not be true to show acct id because they are not the same. It is the requirement that I need to code with look at the table.
SELECT ACCTID, NDATE,NOTETXT,APPSTATUS
FROM TABLEA;
This is a sample select statement that my requirement will be based on.
ACCTID NDATE NOTETXT APPSTATUS
------ ---------- --------------- --------------------
1 2/6/2023 FIRE INCIDENT NO NOTICE
2 3/9/2024 MINOR FIRE NOTICE TO PROCESS
3 9/9/2024 NO INCIDENT NOTICE TO PROCESS
4 3/7/2024 NOTICE ON HOLD
my interest is on the records with 'notice to process' . Note: Notice to process is the same as application complete. If the requirement is coded properly it will address the given requirement. The actual record is over a million records.
I used OR to indicate that if condition 1 is met show acctid, if condition 2 is met show acctid. Both conditions must not be true to show acct id because they are not the same. It is the requirement that I need to code with look at the table.
SELECT ACCTID, NDATE,NOTETXT,APPSTATUS
FROM TABLEA;
This is a sample select statement that my requirement will be based on.
ACCTID NDATE NOTETXT APPSTATUS
------ ---------- --------------- --------------------
1 2/6/2023 FIRE INCIDENT NO NOTICE
2 3/9/2024 MINOR FIRE NOTICE TO PROCESS
3 9/9/2024 NO INCIDENT NOTICE TO PROCESS
4 3/7/2024 NOTICE ON HOLD
my interest is on the records with 'notice to process' . Note: Notice to process is the same as application complete. If the requirement is coded properly it will address the given requirement. The actual record is over a million records.