Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Filtering the records using a column which is having data for few records and nulls for few records

user8113800Aug 23 2016 — edited Aug 24 2016

Hi,

One of the column in my table is having nulls and data for few records i.e. it is not a mandatory column during data load.

For example there may be few records with data as "Cancellation". I want to use this as a filtering condition for one of my requirement.

I am aggregating the data based on certain conditions and i want to exclude the record which is having specific data in the aggregation.

The query would be something like below and I am referring column3 in the query. As the table contains nulls for column3, it is not producing me desired results. Hence, do I need to have some dummy data in Column 3 for all the records to make this query work?

select column1,column2,sum((value-column5)-(column6+column7+column8+column9)) as FRESH_COMM_Agg

from XXXX

where column10 between v_startdate and v_enddate

and co=2 and channel='XXX' and genericattribute1 not in (select locationname from location_name) and genericattribute1<>'XXX'

and column11 in (select column1 from YYYY where column2 ='XXX')

and column4='FRESH'

and column3 <>'Cancellation'

group by column1,column2

Regards,

Badari B.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 21 2016
Added on Aug 23 2016
17 comments
1,049 views