MySQL

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsDatabasesMySQL

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old November 7th, 2012, 01:12 PM
venkat068 venkat068 is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 2 venkat068 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 28 sec
Reputation Power: 0
Generating Percentage compliance for each month in a new table

Hello,

When i run the below script is am getting the total percentage from 2012-Apr-01 to currentdate, which is Numerator/Denomeatorx100

Can i know how to generate the percentage for each month from APR2012 TO CURRENT againaist each ward into a new table?

Ward Apr 12 May 12 June 12 July 12
APP 60%
APB 55%
APM 49%



SELECT xx.EDD/(select CAST(count(*) as Int) as "TEP" from

(select admission_number, admission_date, discharge_date ,estimated_discharge_date, create_date, DIM_IP_ADMISSIONS.update_date,CURRENT_WARD_CODE,cu rrent_flag

from DIM_IP_ADMISSIONS

WHERE DATEDIFF(YEAR,person_date_of_birth,ADMISSION_DATE) >=65

and person_deceased = 'N'

and visit_status in ('A', 'D')

and CURRENT_WARD_CODE in ('APP','APB''APM','MTR','MFT')

and admission_date between '2012-04-01 00:00:00.000' and GETDATE()

and current_flag ='y') as y

)

FROM

(select CAST(count(*) as Int)*100 as "EDD" from

(select DISTINCT A.ADMISSION_NUMBER

from DIM_IP_ADMISSIONS A

INNER JOIN

(select * from DIM_IP_ADMISSIONS B

where B.current_flag ='Y') B

ON A.ADMISSION_NUMBER =B.ADMISSION_NUMBER

WHERE

A.estimated_discharge_date IS NOT NULL

and isnull(A.update_date,A.create_date)<= A.admission_date + 2

and DATEDIFF(YEAR,A.person_date_of_birth,A.ADMISSION_D ATE) >=65

and A.person_deceased = 'N'

and A.visit_status in ('A', 'D')

and A.CURRENT_WARD_CODE in ('APP','APB''APM','MTR','MFT')

and A.admission_date between '2012-04-01 00:00:00.000' and getdate()) as x) as xx

Reply With Quote
Reply

Viewing: Tutorialized ForumsDatabasesMySQL > Generating Percentage compliance for each month in a new table


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap