我尝试在我的SQL语法使用COUNT(DISTINCT ..)),这是我的SQL语法:SQL语法错误(COUNT(DISTINCT ..))
SELECT COUNT (DISTINCT ID)
FROM teaches
WHERE semester = 'Spring' AND year = 2010;
但是,语法不工作,有什么问题?
这是错误消息:
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 'WHERE semester = 'Spring' AND year = 2010' at line 1
这是我的 '教' 表:
create table teaches(
ID char(5),
course_id varchar(8),
sec_id varchar(8),
semester varchar(6),
year numeric(4,0),
foreign key (course_id, sec_id, semester) references section (course_id, sec_id, semester)
)
什么是您的错误信息? –
这是错误信息,我编辑了我的问题。 –
你的桌子“教”什么结构? –