Home » SQL & PL/SQL » SQL & PL/SQL » Figuring out weekly counts
Figuring out weekly counts [message #208980] Tue, 12 December 2006 18:52 Go to next message
razielmj
Messages: 2
Registered: December 2006
Junior Member
Hi All,
I would greatly appreaciate some help to this question.
I would like to search between two dates Feb 2006 and Nov 2006 for the number of people who got flu vaccines by age.

Age_of_flu_shot Number_of_shots
---------------- ---------------
<6 weeks 23
6 weeks 42
7 weeks 2
8 weeks 9

and on for total of 34 weeks.
Now I using,
Where flu_date is = date_of_birth + 7*9 for nine weeks and so on not the best way to do this Im sure but Im stuck.
Anyone know a solution for this.
Thanks
Re: Figuring out weekly counts [message #208982 is a reply to message #208980] Tue, 12 December 2006 19:11 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
SELECT   --object_type, 
   SUM (CASE WHEN created <= SYSDATE - 500 THEN 1 END) lt500,
   SUM (CASE WHEN created BETWEEN SYSDATE - 500 AND SYSDATE - 50 THEN 1 END) from_50_500,
   SUM (CASE WHEN created BETWEEN SYSDATE - 50 AND SYSDATE - 0 THEN 1 END) from_1_50
FROM user_objects
--GROUP BY object_type;

     LT500 FROM_50_500  FROM_1_50
---------- ----------- ----------
       109         707          6
Re: Figuring out weekly counts [message #209216 is a reply to message #208980] Wed, 13 December 2006 18:11 Go to previous message
razielmj
Messages: 2
Registered: December 2006
Junior Member
Thanks Andrew you have given me some ideas!
Previous Topic: as of Timestamp and Flashback Setting
Next Topic: Report Formatting
Goto Forum:
  


Current Time: Wed Dec 07 08:34:31 CST 2016

Total time taken to generate the page: 0.19130 seconds