'QUERY ERROR : ORA-00937: not a single-group group function

I'm trying to query the percentage of correct answers in my oracle db

SELECT 
    (Count(P2.Id) /(
        SELECT Count(*) FROM POSTS P WHERE P.OwnerUserId = 1
        AND P.PostTypeId = 2)* 100) AS AcceptedPercentage
FROM
    POSTS P1
  INNER JOIN
    POSTS P2 ON P1.AcceptedAnswerId = P2.Id
WHERE
    P2.OwnerUserId = 1
  AND
    P2.PostTypeId = 2;

But it gives me this error, how can I fix this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source