Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Dividing in SQL
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Dividing in SQL

 Post Reply Post Reply
Author
mamorley View Drop Down
Newbie
Newbie


Joined: 25 November 2003
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote mamorley Quote  Post ReplyReply Direct Link To This Post Topic: Dividing in SQL
    Posted: 25 November 2003 at 4:49pm

I have the following query and am not having success getting it to run.  Can anyone help me troubleshoot?  Essentially I am trying to divide the first count by the second.

 

select count (*)
       from R5events
          where evt_completed <=   evt_target
          and evt_rstatus = 'C'
          and evt_person = 'MORLEY-MP'
/
select count (*)
       from R5events
          where evt_person = 'MORLEY-MP'

 

Thanks

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 26 November 2003 at 9:36am
Select
(
select count (*)
       from R5events
          where evt_completed <=   evt_target
          and evt_rstatus = 'C'
          and evt_person = 'MORLEY-MP'
)
/
(
select count (*)
       from R5events
          where evt_person = 'MORLEY-MP'
)
as mydivision
Back to Top
mamorley View Drop Down
Newbie
Newbie


Joined: 25 November 2003
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote mamorley Quote  Post ReplyReply Direct Link To This Post Posted: 26 November 2003 at 2:11pm
Thanks Michael, but getting an error stating FROM keyword not found where expected....
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 26 November 2003 at 2:57pm
Seems you are using access or so which always had problems doing subqueries. I am not sure how to do it with something like access, actually gave it a quick try but does not like any of the solutions I offered. Anyway, maybe someone else here knows access a little better.
Back to Top
mamorley View Drop Down
Newbie
Newbie


Joined: 25 November 2003
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote mamorley Quote  Post ReplyReply Direct Link To This Post Posted: 26 November 2003 at 3:22pm

Thanks for your help Michael...

I am actually using sql to query an oracle database...

Back to Top
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post Posted: 29 November 2003 at 2:07am

If using Access it might need the AS after the count (FROM R5events AS myCount).

Hope it solves it.

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.