17,086
社区成员
![](https://csdnimg.cn/release/cmsfe/public/img/topic.427195d5.png)
![](https://csdnimg.cn/release/cmsfe/public/img/me.40a70ab0.png)
![](https://csdnimg.cn/release/cmsfe/public/img/task.87b52881.png)
![](https://csdnimg.cn/release/cmsfe/public/img/share-circle.3e0b7822.png)
with Core as
(select co.course_number,
(case
when termid=((substr('¶m1',1,4))-'1990') *100
then substr('¶m1',1,9)
when termid=((substr('¶m1',1,4))-'1990')*100+1
then 'S1'
when termid=((substr('¶m1',1,4))-'1990')*100+2
then 'S2'
when termid=((substr('¶m1',1,4))-'1990')*100+3
then 'Q1'
when termid=((substr('¶m1',1,4))-'1990')*100+4
then 'Q2'
when termid=((substr('¶m1',1,4))-'1990')*100+5
then 'Q3'
when termid=((substr('¶m1',1,4))-'1990')*100+6
then 'Q4'
end)
as Term,
co.course_name,cc.section_number,cc.teacherid,cc.studentid from
cc join courses co
on co.course_number=cc.course_number
and termid>=UPPER(
(select ((substr('¶m1',1,4))-'1990')*100 from dual))
group by co.course_number, co.course_name,cc.section_number,cc.teacherid,cc.studentid,
(case
when termid=((substr('¶m1',1,4))-'1990') *100
then substr('¶m1',1,9)
when termid=((substr('¶m1',1,4))-'1990')*100+1
then 'S1'
when termid=((substr('¶m1',1,4))-'1990')*100+2
then 'S2'
when termid=((substr('¶m1',1,4))-'1990')*100+3
then 'Q1'
when termid=((substr('¶m1',1,4))-'1990')*100+4
then 'Q2'
when termid=((substr('¶m1',1,4))-'1990')*100+5
then 'Q3'
when termid=((substr('¶m1',1,4))-'1990')*100+6
then 'Q4'
end)
order by course_number,section_number)
SELECT COURSE_NUMBER,TERM,COURSE_NAME,SECTION_NUMBER,TEACHERNAME,STUDENT_NUMBER,StudentName,HOME_ROOM,FATHERPHONE,FATHEREMAIL,MOTHERPHONE,MOTHEREMAIL FROM
(
select course_number,Term,course_name,section_number,t.lastfirst as TeacherName,student_number,s.lastfirst as StudentName,s.home_room,MF.CUST_FATHERMOBILEPHONE AS FATHERPHONE,MF.CUST_FATHEREMAIL AS FATHEREMAIL,MF.CUST_MOTHERMOBILEPHONE AS MOTHERPHONE,MF.CUST_MOTHEREMAIL AS MOTHEREMAIL
from students s
join core c
on s.id=c.studentid
and s.enroll_status='0'
join teachers t
on t.id=c.teacherid
join U_STUDENTSUSERFIELDS MF
on MF.studentsdcid=s.dcid
)
WHERE
course_NUMBER=UPPER('¶m2')
and
(
(case
when
'¶m3' is null
and 1=1
then 1 end )=1
or
(case
when '¶m3' is not null
and
(
section_number in (
select substr(regexp_substr(UPPER('¶m3'),
'[^,]+',
1,
level),
1
,40)
from dual
connect by level <= regexp_count(UPPER('¶m3'),
',') + 1)
)
then 1 end)=1
)
order by course_number,section_number,studentname,student_number
;