sql - How to skip static(hardcoded entry) entry in PostgreSQL if value is NULL? -


i have written following query data retrieval in jasper report.

select d.description description,d.upload_count count (select a.doc_type,b.description,count(*) upload_count case_uploads a,doc_type b a.doc_type = b.doc_type , a.upload_dt >= $p{start_date} , a.upload_dt <= $p{end_date} group a.doc_type,b.description) d d.doc_type not in ('215','f35')  union  select 'applications' description,sum(d.upload_count) count (select a.doc_type,b.description,count(*) upload_count case_uploads a,doc_type b a.doc_type = b.doc_type , a.upload_dt >= $p{start_date} , a.upload_dt <= $p{end_date} group a.doc_type,b.description) d d.doc_type in ('215','f35') 

here, in database have data june 2015 only. if start_date , end_date month other june.

so in case don't want display data in result set. query contains 'applications' hard coded value, adding entry in result set null value.

 description     count ------------------------ applications     null 

because of null value, jasper report throwing "null pointer exception" after execution.

i want skip entry if data not retrieved. there way achieve this?

based on comments, can use this:

select d.description description,d.upload_count count (select a.doc_type,b.description,count(*) upload_count case_uploads a,doc_type b a.doc_type = b.doc_type , a.upload_dt >= $p{start_date} , a.upload_dt <= $p{end_date} group a.doc_type,b.description) d d.doc_type not in ('215','f35') , d.upload_count not null  union  select 'applications' description,sum(d.upload_count) count (select a.doc_type,b.description,count(*) upload_count case_uploads a,doc_type b a.doc_type = b.doc_type , a.upload_dt >= $p{start_date} , a.upload_dt <= $p{end_date} group a.doc_type,b.description) d d.doc_type in ('215','f35') having sum(d.upload_count) not null 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -