1.11M Members

Display Records Between 2 Dates [VARCHAR IN DATABASE TABLE]

 
0
 

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.

 
0
 

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

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: