我有多所学校,有多个年级和各种状态。 如果状态为-1或0,我需要得到每所学校每个年级的计数 这些都来自同一张桌子。 '学生' 如果成绩等于0且学校等于1234,我需要计数 如果等级等于1且学校等于1234,则在该计数旁边 如果等级等于2且学校等于1234,则在该计数旁边 下一行是针对不同的学校,等等。每行不同的学校,每一行的等级从0到12。
我试过
select Sched_NextYearGrade,
sum(case when Sched_NextYearGrade = ‘1’ then 1 else 0 end) as 'firstcount'
sum(case when Sched_NextYearGrade = '2' then 1 else 0 end) as 'secondCount'
from Students
Where (ENROLL_STATUS BETWEEN -1 AND 0)
group by Sched_NextYearGrade
我得到了
ORA-00911: invalid character
00911. 00000 - "invalid character"
*Cause: identifiers may not start with any ASCII character other than
letters and numbers. $#_ are also allowed after the first
character. Identifiers enclosed by doublequotes may contain
any character other than a doublequote. Alternative quotes
(q'#...#') cannot use spaces, tabs, or carriage returns as
delimiters. For all other contexts, consult the SQL Language
有人可以帮忙吗?提前致谢
答案 0 :(得分:3)
‘1’
的引号错误。它们应该是简单的引号:'1'
。