Results 1 to 2 of 2

Thread: ORA-00937 error

  1. #1
    Join Date
    Dec 2004
    Posts
    1

    Question Unanswered: ORA-00937 error

    I want to lis the dept with the smalles cumulative salary. I tried the foll query in Oracle

    Select deptno, min(sum(sal))
    from emp
    group by deptno;

    I get the foll error message

    ORA-00937 error: Not a single group group function

    What is wrong here? Please help!

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    i love that error number!!

    what is wrong is that you cannot nest aggregate functions like that

    i don't do oracle but i think the answer is something like:
    Code:
    select dept
         , sumsal as minsumsal
      from (select dept
                 , sum(sal) as sumsal)
              from emp
            group
                by dept
            order
                by sum(sal) asc)
     where rownum=1
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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