Hello all,
I am using oracle 9.2 and using Oracle SQL Developer
I have a case statement as such
What I am trying to do is look at each record one at a time and based on the recordset if the first value has a.statein XXX or BBB then examine that record and see if it meets all the rest of the criteria that I put in my case statement and if it does then give me a 1. If it doesn't keeping moving down the recordset for each a.id and find the record that meets the criteria and make that the first value. I am trying to ignore all records(not remove) that don't have the appropriate field value. Is this possible? I do not want to remove these records as I need to perform other case statements and all records are needed.
I am using oracle 9.2 and using Oracle SQL Developer
I have a case statement as such
Code:
(CASE WHEN a.name= first_value(a.name IGNORE NULLS) OVER (Partition by a.date order by a.ID) and a.state= 'done' and a.listinggr IN ('XXX', 'BBB') then 1
WHEN a.name= first_value(a.name IGNORE NULLS) OVER (Partition by a.date order by a.id) and a.state= 'done' and a.listinggr NOT IN ('XXX', 'BBB') then First_value = the value where a.listinggr = XXX or BBB and if this is true give this a 1
else 0 END) Pleasehelp
What I am trying to do is look at each record one at a time and based on the recordset if the first value has a.statein XXX or BBB then examine that record and see if it meets all the rest of the criteria that I put in my case statement and if it does then give me a 1. If it doesn't keeping moving down the recordset for each a.id and find the record that meets the criteria and make that the first value. I am trying to ignore all records(not remove) that don't have the appropriate field value. Is this possible? I do not want to remove these records as I need to perform other case statements and all records are needed.