Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2002
    Location
    Bay Area
    Posts
    511

    Unanswered: Can I Display More than 1 Group and Calculation

    I am studying Oracle SQL+ and would like to know if it is possible to run multiple calculations by group from the same table in a query.

    Example data: Name, Gender, Age, Salary
    Joe,M,21,50000
    Sue,F,35,59000
    ...
    Cal an SQL+ query display average age by gender and average salary by age as in the following format?

    Gender Avg Age Age Avg Salary
    ------- -------- ---- ----------
    M 25 21 40,000

    Thanks.
    Jerry

  2. #2
    Join Date
    Jul 2003
    Posts
    2,296
    analytics baby!
    A NA LYTICS!

    PHP Code:
    select distinct 
       gender
    ,
       
    avg(ageover (partition by genderavg_age_by_gender,
       
    age,   
       
    avg(salaryover (partition by ageavg_sal_by_age
    from information_table

    - The_Duck
    you can lead someone to something but they will never learn anything ...

  3. #3
    Join Date
    Jan 2002
    Location
    Bay Area
    Posts
    511
    Thanks for the quick reply to my SQL question. I will try your solution later on my home PC.

    Jerry

Posting Permissions

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