Search code examples
mysqlmysql-workbench

MySQL Workbench reports "is not valid at this position for this server version" error


For the following SQL query:

SELECT COUNT (distinct first_name) from actor;

I receive the following error message:

"SELECT" is not valid at this position for this server version, expecting: '(', WITH

I am a total newbie at SQL. How do I resolve this error?

I put the exact same line at another PC with the exact same schema and it worked fine.


Solution

  • Have you tried to run the query deleting the space between "COUNT" and the bracket? I run a similar query to yours on MYSQL 5.7 and it gives me an error, but without that space the query runs.

    Let's try this:

    SELECT COUNT(DISTINCT first_name) FROM actor;