Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2009
    Posts
    1

    Unanswered: ORA-00979: not a GROUP BY expression

    How can I restructure this query to avoid the dreaded ORA-00979?

    SELECT (TRUNC(address / 16777216)) AS "BLOCK_NUMBER", (COUNT(*)) AS "UTILIZED"
    FROM "NET_IPV4ADDRESS"
    WHERE ("NET_IPV4ADDRESS"."ADDRESS" >= 0 AND
    "NET_IPV4ADDRESS"."ADDRESS_DOMAIN_ID" = 1 AND
    "NET_IPV4ADDRESS"."ADDRESS" <= 4294967295 AND
    "NET_IPV4ADDRESS"."PING_ALIVE" = True )
    GROUP BY TRUNC(address / 16777216)
    ORDER BY "NET_IPV4ADDRESS"."ADDRESS" ASC;

    Thanks in advance!

    Clay

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    You cannot ORDER the results of a GROUP BY query by something that isn't in the query. You can use:

    Code:
    ORDER BY TRUNC(address / 16777216) ASC
    However, this line will not work in Oracle:

    Code:
    "NET_IPV4ADDRESS"."PING_ALIVE" = True
    There are no Booleans in Oracle's 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
  •