MySQL Workbench reports “is not valid at this posi

2019-06-20 07:04发布

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.

2条回答
冷血范
2楼-- · 2019-06-20 07:25

Mine error resolved using 'db_name.' with table although I have already executed use 'db_name' command;

select * FROM db_name.table_name;
查看更多
Animai°情兽
3楼-- · 2019-06-20 07:30

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;
查看更多
登录 后发表回答