Help in finding the total count for each month

Hello everyone,
Sometime back I had posted about the date function. I have that problem solved now my problem is that after finding all records which against each record I need to find the total count for that month if no records than I have to set it to a 0.
Here is how my program has been written.
PROCEDURE extract_materials
IS
CURSOR xyz
BEGIN
FOR xyz1 IN xyz LOOP
-- once inside the loop for each of the record from
the cursor I need to find a total count for that record for everymonth in the year.
All these records will be instered in to a staging table
Can you please help me out with this. I really appreciate this.
Thanks in advance.
-Vani

Andrew - you missed the tricky bit of the spec - include missing months with a zero.
You need to do an outer join to a select from any big table with a function involving rownum and add_months to generate all the possible months. However, its time to go home and I can't be bothered to work out the finer details.

Similar Messages

  • How do I find the start day of each month

    Hi all,
    Hope someone can give a a hand here I've to do a calender project for college and I'm not allowed to use any built in Java classes so fun all the way so far :-)
    I've got one question that is bugging me at the moment. and that is how to find the start day for each month in a year and store them in an array.
    I'm starting my week at Monday (0) and stopping at Sunday (6) and I do have a formula for discovering the first day in Jan of the given year its
    ((y-1900)*365 + (y-1901)/4)%7
    I was just wondering how I could amend this to find the first day in Feb, March etc.
    Any suggestions greatly accepted.
    Thanks in advance.

    Irish-Student wrote:
    newark maybe I didnt make clear exactly what I want to do.
    I have each day of the week starting at 0 for Monday up to 6 for Sunday I want to map what the start day of a month as a number between 0 and 6.
    The formula I have discovering the first day of Jan of a given year will give you 1 i.e. Tuesday
    what I need to do is find out what number between 0 and 6 the start day of each other month of a given year is.
    For example the 1st of Feb is a Friday which is 4 on the weekday map.
    Your suggestion of 31%7 won't work for this, sorry more than likely my fault for not being clearer in what my requirements were.
    Cheers for the help so far and yep your right not being able to use the built in classes is a pain :-)
    Edited by: Irish-Student on 03-Mar-2008 20:01This doesn't really change much of my first suggestion. If you can already calculate the first day of the month of January for any given year, then there's no problem figuring out the other months. Say I want to know the first day April 1, 1978. You already know how to find January 1, 1978. So find that. Then find the number of days between January 1 and April 1 (remember to account for leap years). Once you have the number of days, you can figure out how many weeks and days that is, and thus what day of the week it is.

  • Where can I find the file sizes for each application before downloading?

    Where can I find the file sizes for each application before downloading? I have limited download (525 MBs/day) because of Hughsnet and I need to know each applications total size before I download.

    You can go to the trial page to get an estimated size.  As the Creative Cloud products change over time though this may become less accurate.
    If you are on a limited bandwidth account then you may want to consider purchasing a perpetual copy of Creative Suite 6 as opposed to subscribing to the Creative Cloud.

  • I need help to find the serial number for Photoshop Elements 11

    Hi! I need help to find the serial number for Photoshop Elements 11 I downloaded last year on Apple Application Store.. I have been using photoshop on mac for over a year and now need the serial number to be able to use it on macbook. I looked up Adobe's website for help but found none and noone to ask for support.. Any ideas how I can get the serial number using the App Sore bill I have?

    Please post Photoshop Elements related queries over at
    http://forums.adobe.com/community/photoshop_elements

  • Can anyone help me find the raw converter for Nikon D4/ I have Aperture 3.0 with Snow Leopard. thanks in advance

    hi,
    Having problems finding the correct download for a Nikon D4 raw converter.
    Can anyone help direct me to the right link?
    I am using Aperture 3.0 with Snow leopard.
    thanks in advance
    Mark

    Nikon D4 is supported by Digital Camera RAW Compatibility Update 3.10:
    http://support.apple.com/kb/DL1510
    Check the System requirements, if it is compitability with your installation Mac OS X 10.6.8.
    Regards
    Léonie

  • Problem in finding the total count

    my table as below:
    ID code group cand
    A 001 01 1
    A 001 02 1
    A 001 02 2
    A 002 01 1
    A 003 01 1
    B 001 01 1
    B 001 01 2
    B 001 02 1
    B 002 01 1
    C 002 01 1
    C 002 01 2
    C 003 01 1
    Here is what I want
    ID Code tot_grp num_cand
    A 001 4 3
    A 002 4 1
    A 003 4 1
    B 001 3 3
    B 002 3 1
    C 002 2 2
    C 003 2 1
    where tot_grp is the total number of groups for each ID
    and num_cand is the total number of candidates for each ID with that specific
    code
    Can I do it in one sql statement ?
    Thank you

    you said
    where tot_grp is the total number of groups for each ID
    and num_cand is the total number of candidates for each ID with that specific
    code
    Can u be more specific what should be present in tot_grp column.
    Is it contains
    a)sum of group for a given ID & code combination.
    If yes then sql would be
    select id,code,sum(group) tot_grp,count(cand) num_cand
    from <table_name>
    group by id,code
    having the output ID Code tot_grp num_cand
    A 001 5 3
    A 002 1 1
    A 003 1 1
    B 001 4 3
    B 002 1 1
    C 002 2 2
    C 003 1 1
    2) Total No of groups(only the count) for a given Id & code
    If yes then sql would be
    select id,code,count(group) tot_grp,count(cand) num_cand
    from <table_name>
    group by id,code
    having the output ID Code tot_grp num_cand
    A 001 3 3
    A 002 1 1
    A 003 1 1
    B 001 3 3
    B 002 1 1
    C 002 2 2
    C 003 1 1
    If none of the above condition is correct can u please be more clear .

  • Getting the max count for each group

    Hi, I am a newbie and working on a project for school. I have been working this problem for a couple of days and made a bit of progress.
    I have two tables, student and enroll for a college database. I need to show the students who have the most enrollments in each major. So far, I have:
    WITH COUNT_Q AS
    SELECT B.SSN, B.MAJOR, COUNT (A.CLASS_NO) AS COUNTCLASS
    FROM ENROLL A, STUDENT B
    WHERE A.SSN = B.SSN
    GROUP BY B.SSN, B.MAJOR
    SELECT MAX(COUNTCLASS), MAJOR
    FROM COUNT_Q
    GROUP BY MAJOR
    I am getting the correct results but need to show the SSN and Major of the studens. When I add in the SSN and Major, like below, I get back too many records.
    WITH COUNT_Q AS
    SELECT B.NAME, B.SSN, B.MAJOR, COUNT(A.SSN) AS COUNTCLASS
    FROM ENROLL A, STUDENT B
    WHERE A.SSN = B.SSN
    GROUP BY B.NAME, B.SSN, B.MAJOR
    SELECT *
    FROM COUNT_Q
    WHERE (COUNTCLASS) IN (SELECT MAX(COUNTCLASS)
    FROM COUNT_Q
    GROUP BY MAJOR
    Can someone help point me in the right direction?

    SELECT  B.NAME,
            B.SSN,
            B.MAJOR
      FROM  (
             SELECT  B.NAME,
                     B.SSN,
                     B.MAJOR,
                     COUNT(A.CLASS_NO) SSN_MAJOR_COUNTCLASS
                     DENSE_RANK() OVER(PARTITION BY MAJOR ORDER BY COUNT(A.CLASS_NO) DESC) RNK
               FROM  ENROLL A,
                     STUDENT B
               WHERE A.SSN = B.SSN
               GROUP BY B.NAME,
                        B.SSN,
                        B.MAJOR
      WHERE RNK = 1
    /SY.
    Edited by: Solomon Yakobson on Mar 27, 2011 6:53 PM

  • Can someone please help me find the correct driver for my audio ca

    Hello, it's famke again...Still trying to find drivers.. My sound card is apparently also missing drivers... I've tried many drivers from different sites matching the information i've taken off the card...but for some reason i always get a big red slash through my audigy sound control panel after trying to install the driver and reboot my system... I'm convinced i haven't been able to find the correct driver... The information off the card is...Soundblaster Audigy 2ZS M:SB0350... If anyone can help out i would greatly appreciate this...Famke.

    I'm new to this, but I also had trouble for a while in finding and installing the right drivers. Eventually I got it to work with the link below. Follow the steps and select everything it suggests (I did and it worked for me). You might want to try it and see if it works for you too. Good Luck. http://www.creative.com/language.asp...wnloads/su.asp

  • How to find the lowest grade for each student using a Select query?

    Hey I'm having a bit of trouble here
    I have this table
    Student - Grade
    John - 8
    Richard - 9
    Louis - 9
    Francis - 5
    John - 13
    Richard - 10
    Peter - 12
    Grades can range from 0 to 20.
    Name - varchar(50)
    Grade - integer
    I am trying to generate a SQL search to find each lowest grade for each student.
    So far I have done:
    select s.name,s.grade
    from student s
    where s.grade = (select min(grade) from student)
    The result of that search returns me only the lowest grade of all the grades posted above, which is Francis - 5.
    I want to find the lowest grade, but not only for Francis but also for every other student in the table.
    How do I do that?
    Thank you in advanced.

    ok,
    Now we are moving into Analytic SQL:
    with student as (select 'John' name, 8 grade, 'fail' result from dual union all
                     select 'John' name, 13 grade, 'pass' result from dual union all
                     select 'Francis',     5 grade,  'fail' from dual union all
                     select 'Peter', 12, 'pass' from dual)
    -- End of your test data
    SELECT   name,
             MAX (result) KEEP (DENSE_RANK FIRST ORDER BY grade) result,
             MIN (grade) min_grade
    FROM     student
    GROUP BY namePlease note that I passed ;)
    Regards
    Peter
    To read more:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions056.htm#SQLRF00641

  • Can anybody help me find the serial number for my ipod touch on the apple website because it got stolen and i need the sereal number?

    i have done this before but i forgot how.
    i want to see a list of all the products registered in my name.

    You cannot find the ipod using the serial number.  You can give it to the police, so if they find it they can identify it.
    You can indeed find your serial numbers:
    iPod: How to find the serial number

  • Help me find the right processor for my HP Laptop

    I have an Hp dv7-6111sz (LZ664EA) All info are here : pavilion_dv7_6111sz_lz664ea
    I want to upgrade the stock cpu, everythung seems good in my Laptop but the CPU... im using the laptop for gaming, tested things and realized that my CPU is overnecking my GPU, So please what do you advice me? should I upgrade my cpu? if yes how and where to find better CPU? if no.... hmm why not? what are disadvantages other than over heating??... 
    And another thing, im not sure but is my hardware looks for gaming? I'm playing high-end games like Watch dogs and Assassin's Creed 4... hmm 20fps on medium settings, I think those games are poorly optimized,  idk. What do you recommend,  should I buy a new Laptop? I want it for gaming so what do you advice? thanks

    Hi,
    Page #1 of the first manual on the following link may help. There is a list of CPU's supported around that time:
         http://h10025.www1.hp.com/ewfrf/wc/manualCategory?cc=us&lc=en&product=5144913
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • Where can I find the system requirements for each version of firefox. I would like to know which version of Firefox is best for my 6-8 year old computer with AMD Sempron 2500+ 1,75 GHz and 512 RAM.

    I tried to find information of that very hard in your pages but missed. Is it possible to have system requirements somethere in firefox homepages?
    I don't want to try a newer version and then have a hard fishing of the earlier version which works.

    Just change the version number of following links
    like this
    * http://www.mozilla.org/en-US/firefox/3.6/system-requirements/
    * http://www.mozilla.org/en-US/firefox/7.0/system-requirements/
    * http://www.mozilla.org/en-US/firefox/5.0/system-requirements/
    * http://www.mozilla.org/en-US/firefox/8.0/system-requirements/

  • Where can I find the program updates for each updated version of Flash Player?

    Where can I find info on different updated versions of Flash Player?
         This info includes:
              Changes/updates/improvements to the program
              Version number
    Also, how do I view my own program's version number?  I'm sure it's straightforward but I haven't tried looking.
    Thanks.

    Most updates are announced here http://forums.adobe.com/community/flashplayer/announcements
    To find your installed version go to http://helpx.adobe.com/flash-player/kb/find-version-flash-player.html

  • Please help me find the right tool for the VGA Card bracket switching job

    Okay I found a great PCI-e x16 Half Height Card, however it was installed with a full height bracket. It also included a low profile bracket, but what is the correct tool I need to change out the bracket?
    Can I get these tools at Best Buy? Please tell me the exact specifications and dimensions of
    the tool I need and I can be gaming as early as tomorrow afternoon!
    *******DISCLAIMER********
    I am not an employee of BBY in any shape or form. All information presented in my replies or postings is my own opinion. It is up to you , the end user to determine the ultimate validity of any information presented on these forums.

    Replied to in double post timed 10 minutes later.  'What password protected address book App' etc.

  • Help for total count in a month

    Hello everyone,I am reposting this message with the hope that I will get some help. Please help me I have a deadline to meet and maybe getting late in meeting the deadline.
    Sometime back I had posted about the date function. I have that problem solved now my problem is that after finding all records which against each record I need to find the total count for that month if no records than I have to set it to a 0.
    Here is how my program has been written.
    PROCEDURE extract_materials
    IS
    CURSOR xyz
    BEGIN
    FOR xyz1 IN xyz LOOP
    -- once inside the loop for each of the record from
    the cursor I need to find a total count for that record for everymonth in the year.
    All these records will be instered in to a staging table
    Can you please help me out with this. I really appreciate this.
    Thanks in advance

    Take a look at analytic functions-- they should be just what the doctor ordered.
    Justin

Maybe you are looking for

  • JSF and reports in PDF

    Hello Everybody, I�m using jasper reports to generate PDF reports. First thing user do is select the begin date and the end date for the report, after data I would like the report being open in a new window. I�m processing the report in a Managed Bea

  • HT2589 no "none" option.

    I have bought an Ipod 4g. However when i am trying to log in to itunes, in the payment options part it asks for credit card information. As i dont have a credit card the itunes store has been annoying me a lot. Earlier there used to be a "none" optio

  • After initial import, I end up with tons of duplicates

    I bought my first Mac (macbook) about 3 months ago and am just trying iPhoto. I keep ending up with several copies of the same photos when I initiate the import. The Mac setup as folders is a little confusing to me but I chose the folders that had my

  • IPad Air 2 Charger

    I just purchases an iPad Air 2 64GB.  I was surprised during unboxing that the charger it comes with is 10 watts when the iPad 4th generation and first iPad Air came with a 12 watt charger.  Does anyone know why Apple reverted to the weaker charger? 

  • Tv@anywhere master mpeg 4 support??

    Says it has mepeg 4 realtime encoding support? i think this is a false claim you can't capture in this format realtime with the software provided with the card.