Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Week Number of the Year Question

Re: Week Number of the Year Question

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Mon, 21 Nov 2005 07:16:22 +0100
Message-ID: <43816637$0$4335$626a54ce@news.free.fr>

"Greg" <esabens_at_yahoo.com> a écrit dans le message de news: 1132552017.557366.155920_at_g14g2000cwa.googlegroups.com...
| I'm very sorry if this has been hashed here several times before. I
| honestly have been searching the web and newsgroups for hours today for
| answers.
|
| I'm somewhat new to SQL (about 8 short months under my belt) and my
| learning has been limited to several SQL tutorials on the web and
| several "Learn SQL in XX Hours" books. I've been requested to create a
| query for a report that counts the number of patient visits to a list
| of providers throughout a year but the visits are to be totaled by the
| weeks of the years.
|
| Example:
| Week 1
| Dr Jones 8 visits
| Dr Smith 4 visits
|
| Week 2
| Dr Jones 63 visits
| Dr Smith 74 visits
| ...
| ...
|
| I've found that I can use TO_CHAR and WI or WW (WI works better for me)
| to find the week, I'm just having trouble figuring out how to mix that
| information in with my query (told you I was fairly new with this).
|
| My query is simply:
| select provider, patientid, visitdate, visittype
| from visit_table
|
| I'm probably making this harder than it is, but for some reason I'm
| thinking I have to do a sub-query in here to get the query to count
| visits by weeknumber for each provider, but I'm just not getting it.
|
| Any help would be very appreciated
| Thank you!
| Greg
|

You almost get it. You have the provider, you have the week (as you said), just add the count grouping by these two. http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions26a.htm#82699

Regards
Michel Cadot Received on Mon Nov 21 2005 - 00:16:22 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US