Hello.

I stored dateFrom & dateTo as String '11/11/2011' and '11/25/2011' [mm/dd/yyyy] format.
now when i fired query as below

select (case when  pp_send_date_to_district between '11/01/2012' and '11/25/2012' then 'Dec/2012' else 0 end ) as Months,  

sum(case when  pp_send_date_to_district between '11/01/2012' and '11/25/2012' then 1 else 0 end ) as TotalCases ,sum( case  

when (pp_send_date_to_district between '11/01/2012' and '11/25/2012') and PP_DATE_OF_FINALREPORT_SENT_TO_RPO !='NA' then 1 

else 0 end) as DisposedCases,( sum(case when  pp_send_date_to_district between '11/01/2012' and '11/25/2012' then 1 else 0 

end ) -sum( case when (pp_send_date_to_district between '11/01/2012' and '11/25/2012') and PP_DATE_OF_FINALREPORT_SENT_TO_RPO 

!='NA' then 1  else 0 end)) As Pending, ( sum( case when (pp_send_date_to_district between '11/01/2012' and '11/25/2012') and 

pP_DATE_OF_FINALREPORT_SENT_TO_RPO !='NA' then 1 else 0 end)/sum(case when   pp_send_date_to_district between '11/01/2012' 

and  '11/25/2012' then 1 else 0 end )*100 ) as percentage from passport where  pp_district_name = 'CACHAR' group by 

pp_district_name ;

it displays result. But there are no records at all for mentioned 2 dates in query.
It displayed previous year records with the difference of dates as mentioned in query.


Can any one please suggest me how to resolved this ?

Thanks In advance.

Looks like inconsistent data due to bad table design. Show a data sample.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.