If you’re getting an error that reads “function mode() does not exist” in PostgreSQL, it could be that you’re using the wrong syntax with this function.
The mode()
function requires a WITHIN GROUP
clause, and we can get the above error if we remove that clause.
In this case, we can fix the error by adding a valid WITHIN GROUP
clause.