level 1
问题错在含有group by 从句的SELECT之后的列,要么是group by the 列, 要么就要进行聚合运算, 所以你的语句可以改成以下
create view View_Class(Class_Count,Class_name,depar_name)
as
select COUNT(Stu_id),Class_name,Depar_name
from Student,Class,Department
where student.class_id = class.class_id and class.depar_id = department.depar_id
group by Student.class_id,class.class_name,department.depar_name
或者
create view View_Class(Class_Count,Class_name,depar_name)
as
select COUNT(Stu_id),MAX(Class_name),MAX(Depar_name)
from Student,Class,Department
where student.class_id = class.class_id and class.depar_id = department.depar_id
group by Student.class_id
2015年04月28日 13点04分
3