vara reddy

vara reddy

  • NA
  • 209
  • 0

how to display null rows in my sql

Jun 21 2012 12:09 AM
With the help of this query i was unable to show null rows when date was changed.
please help me

select p.partnerid,
sum(case when c.amount is not null then c.amount else 0 end) as amount,
sum(case when c.netamt is not null then c.netamt else 0 end) as netamt,
sum(case when c.netamt - c.amount is not null then c.netamt - c.amount else 0 end) as interest,
sum(case when c.installment = 20 then c.amount else 0 end) as Twenty,
sum(case when c.installment = 10 then c.amount else 0 end) as Ten,
sum(case when c.installment = 5 then c.amount else 0 end) as Five,
sum(case when c.installment = 2 then c.amount else 0 end) as Two
from partnerinfo p left outer join customerinfo c on p.partnerid = c.partnerid
where (c.startdate is null OR (c.startdate >= '2012-3-15' and c.startdate <= '2012-12-30'))
and (c.partnerid is null or c.partnerid) and p.manager = 1
group by p.partnerid




For better understanding here are the images

1.  http://i46.tinypic.com/155l4cp.jpg

2.  http://i49.tinypic.com/357ki3b.jpg

Answers (3)