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

匿名 (未验证) 提交于 2019-12-03 01:38:01

问题:

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.

回答1:

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; 


回答2:

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

select * FROM db_name.table_name; 


易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!