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.
- rao67Sep 16, 2024Copper Contributorthis info help full to my knowladge
- mjsystemssSep 16, 2024Copper ContributorNo. 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. - mjsystemssSep 15, 2024Copper Contributor
The Two conditions are to produce one result set.
The resulting table should be like this;
ACCTID NDATE NOTETXT APPSTATUS
000001 02/06/2023 FIRE INCIDENT NO NOTICE
000002 03/09/2024 MINOR FIRE NOTICE TO PROCESS
000003 09/09/2024 NO INCIDENT NOTICE TO PROCESS
000004 03/07/2024 NO NOTICE
- rodgerkongSep 15, 2024Iron ContributorWhat are the structures of TABLEA and EXAMPLE? And give some sample data in those 2 tables.
Base on the sample data, what is the result you want?- mjsystemssSep 15, 2024Copper ContributorThe Table I have given is a consolidated Table and the table should be filtered based on the requirements below.
acctid number
ndate varchar2(20)
Notetxt Varchar2(50)
AppStatus Varchar2(100)
1. If appstatus !='notice to process' and no notetext in last month show acct and no txt notes
2. if appstatus='notice to process' and no notetext in one month show the results (acctid)