0

我正在编写查询来计算数据库表中不同值的数量。所以我把查询写成:

select count ( distinct user_id ) as unique_users from 1_time_access;

我收到错误

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'distinct user_id ) as unique_users from 1_time_access' at line 1

谁能解释我错过了什么?

4

1 回答 1

3

删除count和左括号之间的空格。

select count(distinct user_id) as unique_users from 1_time_access;
于 2012-06-20T05:22:53.297 回答