We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,590 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Display Records Between 2 Dates [VARCHAR IN DATABASE TABLE]

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.

2
Contributors
1
Reply
13 Hours
Discussion Span
1 Year Ago
Last Updated
2
Views
bikashdas
Newbie Poster
10 posts since Oct 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

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

smantscheff
Nearly a Posting Virtuoso
1,297 posts since Oct 2010
Reputation Points: 321
Solved Threads: 270
Skill Endorsements: 8

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.5133 seconds using 2.71MB