select DISTINCT (100.0*(Select count(*) from events where scheduled_start
>current_timestamp - 1 day)/(Select count(*) from events where status not
like '%Completed%' and scheduled_start >current_timestamp - 1 day)) AS
"Percent" FROM events
-----Original Message-----
From: ADSM: Dist Stor Manager [mailto:ADSM-L AT VM.MARIST DOT EDU] On Behalf Of
Ian
Smith
Sent: Friday, April 17, 2009 7:34 AM
To: ADSM-L AT VM.MARIST DOT EDU
Subject: [ADSM-L] Percent complete
Hi
I need a little reminder on how to do a calculation in a SQL statement:
I want to divide:
Select count(*) from events where scheduled_start >current_timestamp - 1
day
BY
Select count(*) from events where status not like '%Completed%' and
scheduled_start >current_timestamp - 1 day
THEN * 100
I have done this before by putting each statement in brackets but can't
quite remember!!!
Thanks
Ian
Dell Corporation Limited is registered in England and Wales. Company
Registration Number: 2081369
Registered address: Dell House, The Boulevard, Cain Road, Bracknell,
Berkshire, RG12 1LF, UK.
Company details for other Dell UK entities can be found on www.dell.co.uk.
This electronic transmission and any documents accompanying this electronic
transmission contain confidential information belonging to the sender. This
information may be legally privileged. The information is intended only for
the use of the individual or entity named above. If you are not the intended
recipient, you are hereby notified that any disclosure, copying, distribution,
or the taking of any action in reliance on or regarding the contents of this
electronically transmitted information is strictly prohibited.
|