Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003
    Posts
    34

    Unanswered: perecentage increase of 2 counts for the same table

    Hi All

    Here is what i want to acheive.
    Say I have a table emp with the date column (hiredate)
    I have to take counts for one month say month of August 2004. Then I want to take a count for the previous month July 2004 and then display the perecentage increase or decrease for August over July
    How to acheive this.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    ((count(July) - count(august)/(count(august))*100
    You should have learned how to computer percentages in middle school.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Aug 2004
    Location
    France
    Posts
    754
    Provided you want to obtain the increase in hires between july and august, this should work :

    Select
    ((select count(hiredate) from emp where to_char(hiredate, 'MM')='08')-(select count(hiredate) from emp where to_char(hiredate, 'MM')='07'))*100/(select count(hiredate) from emp where to_char(hiredate, 'MM')='07') from DUAL;

    And anacedent, I'd say ((count(august) - count(july)/(count(july))*100 is better than ((count(July) - count(august)/(count(august))*100, for the basis is july, not august.

    Regards,

    RBARAER
    Last edited by RBARAER; 09-01-04 at 07:10.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •