select a.*
from (
select a.lectno,a.cmno,a.payno,a.pino,a.userno,a.status,a.iscomplete,a.isrebate,a.cdt
,pi.pstatus,pi.rstatus
,b.cname,b.classno,b.studytime,b.sstime,b.setime
,bc.refcode
,cg.cgname
,pcg.cgcode pcgcode
,c.tyear,c.tseq
,u.username,u.uduty
,case when uc.cname = '기타' then u.ccpositionetc else uc.cname end ccpositionname
,ua.asname
,row_number() over(order by $orderby$ a.cdt desc ) rno
,count(a.cdt) over() pagetotalcount
from lect a
left outer join payitem pi on pi.pino=a.pino
inner join cm b on b.cmno=a.cmno
left outer join comcode bc on bc.ccode=b.certgradecc
inner join cg cg on cg.cgno=b.cgno
inner join cg pcg on pcg.cgno=cg.pcgno
inner join term c on c.tmno=b.tmno
inner join users u on u.userno=a.userno
left outer join comcode uc on uc.ccode=u.ccposition
left outer join assign ua on ua.asno=u.asno
where a.ischanged=0
and a.lectno=#lectno#
and a.userno=#userno#
) a
order by a.rno
select a.*
from (
select a.lectno,a.cmno,a.payno,a.pino,a.userno,a.status,a.iscomplete,a.isrebate,a.cdt, a.cmisno
,pi.pstatus,pi.rstatus
,b.cname,b.classno,b.studytime,b.sstime,b.setime
,bc.refcode
,cg.cgname
,pcg.cgcode pcgcode
,c.tyear,c.tseq
,u.username,u.uduty
,case when uc.cname = '기타' then u.ccpositionetc else uc.cname end ccpositionname
,ua.asname
,row_number() over(order by $orderby$ a.cdt desc ) rno
,count(a.cdt) over() pagetotalcount
, b.cshape, ifnull(e.scdtype, 1) as scdtype
, (case when e.scdtype is null then h.cname else g.cname end ) as studyplace
, (case when b.cshape=0 then '온라인' when b.cshape=1 then '교육장교육' else '온라인교육' end) cshapename
, a.edate
from lect a
left outer join payitem pi on pi.pino=a.pino
inner join cm b on b.cmno=a.cmno
left outer join comcode bc on bc.ccode=b.certgradecc
inner join cg cg on cg.cgno=b.cgno
inner join cg pcg on pcg.cgno=cg.pcgno
inner join term c on c.tmno=b.tmno
inner join users u on u.userno=a.userno
left outer join comcode uc on uc.ccode=u.ccposition
left outer join assign ua on ua.asno=u.asno
left outer join (
select lectno,max(cmino) as cmino
from lectinning t
group by lectno
) d on a.lectno = d.lectno
left outer join cminning e on b.cmno = e.cmno and d.cmino = d.cmino and e.userno = a.userno
left outer join cminningscd f on a.cmisno = f.cmisno
left outer join comcode g on f.studyplace = g.ccode
left outer join comcode h on b.studyplace = h.ccode
where a.ischanged=0
and a.lectno=#lectno#
and a.userno=#userno#
) a
order by a.rno
select a.lectno
from lect a
inner join lectinning b on b.lectno=a.lectno
a.cmno=#cmno#
limit 1
select count(a.lectno)
from lect a
a.cmno=#cmno#
a.status in (1,2,3,4)
a.ispc=#ispc#
select a.lectno,a.cmno,a.payno,a.pino,a.userno,a.status,a.iscomplete,a.orgcmno,a.attrate,a.isrebate,a.ispc
,b.username,b.isacceptemail
,CAST(AES_DECRYPT(UNHEX(b.email), ) AS char) email
,CAST(AES_DECRYPT(UNHEX(b.mobile), ) AS char) mobile
from lect a
inner join users b on b.userno=a.userno and b.status=1
a.cmno=#cmno#
a.status=#status#
order by b.username
select
a.cmno,c.tyear,c.tseq,d.cgname,b.quota,b.cshape,b.cname,b.classno,b.rstime,b.retime,b.sstime,b.setime,a.countlect,a.countstandby,a.rno,a.pagetotalcount,a.countnoresult,a.countfail,a.countcomplete,a.countsuccess,a.countstanbypay,a.countstanbydraw,a.countstanbyaccept,b.studydays,code.cname studyplacename
from (
select a.cmno,a.countlect,a.countstandby,a.rno,a.pagetotalcount,a.countnoresult,a.countfail,a.countcomplete,a.countsuccess,a.countstanbypay,a.countstanbydraw,a.countstanbyaccept
from (
select b.cmno,count(u.userno) countlect
,sum(case when ifnull(d.isready,0) = 1 and d.status = 3 then 1 else 0 end) countstandby
,sum(case when d.iscomplete is null then 1 else 0 end) countnoresult
,sum(d.iscomplete) countcomplete
,sum(case when d.iscomplete=0 then 1 else 0 end) countfail
,row_number() over(order by $orderby$ case when b.retime < now() then 1 else 2 end,b.retime desc ) rno
,sum(case when d.lectno is not null and p.pstatus=1 then 1 else 0 end) countsuccess
,sum(case when d.lectno is not null and p.pstatus=21 then 1 else 0 end) countstanbypay
,sum(case when d.lectno is not null and p.pstatus = 22 then 1 else 0 end) countstanbydraw
,sum(case when d.lectno is not null and p.pstatus = 55 then 1 else 0 end) countstanbyaccept
,count(a.cdt) over() pagetotalcount
from term a
inner join cm b on b.tmno=a.tmno and b.cshape=#cshape# and b.cname like concat('%',#cnamelike#,'%')
inner join cg c on c.cgno=b.cgno
left outer join lect d on d.cmno=b.cmno and (d.status < 5 or d.status = 6) and d.ischanged=0
left outer join users u on u.userno = d.userno
inner join payitem pi on pi.pino=d.pino
inner join pay p on p.payno=pi.payno
inner join lect d on d.cmno=b.cmno and d.status=#status# and (d.status < 5 or d.status = 6) and d.ischanged=0
left outer join users u on d.userno = u.userno and u.status = 1
inner join payitem pi on pi.pino=d.pino
inner join pay p on p.payno=pi.payno
inner join cmprof pr on pr.cmno=b.cmno and pr.userno=#profno#
a.tyear=#tyear#
a.tmno=#tmno#
b.isdel=0 and (u.status in (1,99) or u.status is null)
date_format(b.sstime,'%Y%m%d') >= date_format(#sstime#,'%Y%m%d') or date_format(b.retime,'%Y%m%d') = '20991231'
date_format(b.setime,'%Y%m%d') <= date_format(#setime#,'%Y%m%d') or date_format(b.retime,'%Y%m%d') = '20991231'
group by b.cmno
having sum(d.iscomplete) < 1
having sum(d.iscomplete) > 0
having sum(case when d.iscomplete is not null then 1 else 0 end) > 0
having sum(case when d.iscomplete is null then 1 else 0 end) > 0
) a
) a
inner join cm b on b.cmno=a.cmno
inner join term c on c.tmno=b.tmno
inner join cg d on d.cgno=b.cgno
left join comcode code on code.cgroup = 'studyplace' and code.ccode = b.studyplace
order by a.rno
select a.lectno,a.cdt,a.status,a.userno,a.oktime,a.cmisno,a.cmno
,af.fileurl,af.fileno,af.orgname
,f.asname,e.asno
,d.username cnoname,d.userid cnoid
,e.username,e.status ustatus,e.depart,e.userid,e.uduty
,e.kfcfyear,e.isassignuser,e.edus
,CAST(AES_DECRYPT(UNHEX(e.email), ) AS char) email
,CAST(AES_DECRYPT(UNHEX(e.mobile), ) AS char) mobile
,CAST(AES_DECRYPT(UNHEX(e.telno), ) AS char) telno
,cc.cname ccpositionname
,c.pstatus,c.payno,c.userno payuserno
,b.rstatus
,a2.rstime,a2.retime,a.sdate sstime,a.edate setime,a2.cshape,a2.studydays
,a.sdate,a.edate,a.isrebate,a.iscomplete
,scd.estart,scd.eend,scd.studyplace
,pp.typeman, pp.typeedu, pp.typegrade, pp.typejob, pp.typejobitem, pp.pplno
,row_number() over(order by $orderby$ a.payno,a.pino ) rno
,count(a.cdt) over() pagetotalcount
,a2.typejobitem as typejobitems
from lect a
inner join cm a2 on a2.cmno=a.cmno
left outer join fileinfo af on af.fgno=a.fgno and af.isdel=0
inner join payitem b on b.pino=a.pino
inner join pay c on c.payno=b.payno
and c.pstatus not in ($paystatusnotin$)
and c.pstatus=#paystatus#
and c.rstatus=#rstatus#
inner join users d on d.userno=c.userno
inner join users e on e.userno=a.userno and e.status in (1,99)
left outer join comcode cc on cc.ccode=e.ccposition
left outer join assign f on f.asno=e.asno
left outer join payrfditem rfdi on rfdi.pino=a.pino
left outer join payrfd rfd on rfd.rfdno=rfdi.rfdno
left outer join cminningscd scd on a.cmisno = scd.cmisno
left outer join pplog pp on c.pplno = pp.pplno
where a.ischanged=0
ifnull(a.isready,0)=#isready#
a.lectno=#lectno#
a.cmno=#cmno#
a.status=#status#
a.status in ($statusin$)
and (rfd.rstatus = 0 and rfdi.rfdno is not null)
(d.username like concat('%', #searchtext#,'%')
or
d.userid like concat('%', #searchtext#,'%'))
date_format(scd.estart,'%Y%m%d') = date_format(#scdestart#,'%Y%m%d')
a.payno=#payno#
and (rfdi.rfdno is null or rfd.rfdno is not null)
order by rno
select a.lectno,a.cdt,a.status
,p.pstatus,p.rstatus
,pu.username cnoname,pu.userid cnoid
,b.username,b.userid,b.uduty
,CAST(AES_DECRYPT(UNHEX(b.email), ) AS char) email
,CAST(AES_DECRYPT(UNHEX(b.mobile), ) AS char) mobile
,CAST(AES_DECRYPT(UNHEX(b.telno), ) AS char) telno
,b.depart,b.kfcfyear,b.isassignuser,b.edus
,(select cname from comcode com where com.ccode = pp.typeman) as typemanname
,(select cname from comcode com where com.ccode = pp.typeedu) as typeeduname
,(select cname from comcode com where com.ccode = pp.typegrade) as typegradename
,(select cname from comcode com where com.ccode = pp.typejob) as typejobname
,scd.estart,scd.eend
,cc.cname ccpositionname
,c.isjoin,c.asname
,row_number() over(order by b.username) rno
from lect a
inner join pay p on p.payno=a.payno
and p.pstatus not in ($paystatusnotin$)
inner join users pu on pu.userno=p.userno
inner join users b on b.userno=a.userno and b.status=#status#
left outer join comcode cc on cc.ccode=b.ccposition
left outer join assign c on c.asno=b.asno
left outer join pplog pp on p.pplno = pp.pplno
left outer join cminningscd scd on a.cmisno = scd.cmisno
where a.cmno=#cmno#
and ifnull(a.isready,0) = #isready#
and a.status < 5 and p.pstatus in (1,22 )
a.status in ($statusin$)
and a.ischanged=0
order by rno
update lect set ,sdate =#sdate#,edate=#edate# where lectno=#lectno# and status = 1
update lect set ,status=#status#,oktime=case when oktime is null and #status# = 4 and status<>4 then now() else oktime end where lectno=#lectno# and status in (3,4,5);
update pay a
inner join lect b on b.lectno=#lectno# and b.payno=a.payno and b.status in (4,5)
set a.pstatus=case when b.status = 4 then 21 else 52 end
where a.pstatus=51;
update payitem a
inner join lect b on b.lectno=#lectno# and b.pino=a.pino and b.status in (4,5)
set a.pstatus=case when b.status=4 then 21 else 52 end
where a.pstatus=51
update lect set ,status=#status#,oktime=case when oktime is null and #status# = 4 and status=6 then now() else oktime end where lectno=#lectno# and status in (4,5,6);
update pay a
inner join lect b on b.lectno=#lectno# and b.payno=a.payno and b.status in (4,5)
set a.pstatus=case when b.status = 4 then 21 else 52 end
where a.pstatus=55;
update payitem a
inner join lect b on b.lectno=#lectno# and b.pino=a.pino and b.status in (4,5)
set a.pstatus=case when b.status=4 then 21 else 52 end
where a.pstatus=55
update lect set
,status = #status#
,oktime = now()
where lectno in ($lectnos$) and status in (4,5,6);
update pay a
inner join lect b on b.lectno in ($lectnos$) and b.payno=a.payno and b.status in (4,5,6)
set a.pstatus=case when b.status = 6 then 55 when b.status = 4 then 21 else 52 end
where a.pstatus in (55, 21, 52);
update payitem a
inner join lect b on b.lectno in ($lectnos$) and b.pino=a.pino and b.status in (4,5,6)
set a.pstatus=case when b.status = 6 then 55 when b.status = 4 then 21 else 52 end
where a.pstatus in (55, 21, 52)
select b.cmno,b.cname,b.classno,b.cshape
,t.tyear,t.tseq
from cm a
inner join cm b on b.ismaster=0 and b.pcmno=a.pcmno and b.cmno <> #cmno# and b.setime is not null and b.setime > now() and b.isuse=1 and b.isdel=0
inner join term t on t.tmno=b.tmno
left outer join lect c on c.cmno=b.cmno and c.status in (1,3,4) and c.ischanged=0
where a.cmno=#cmno#
group by b.cmno,b.cname,b.classno,b.quota,b.cshape
,t.tyear,t.tseq
having b.quota = 0 or b.quota > count(c.lectno)
order by b.cname,b.classno,b.setime
update lect set
,ischanged=1
where lectno=#lectno#;
insert into lect (cmno,payno,pino,userno,status,iscomplete,orgcmno,attrate,isrebate,ispc,isjoin,fgno,ischanged, )
select #cmno#,payno,pino,userno,status,null,cmno,0,isrebate,ispc,isjoin,fgno,0,
from lect a
where a.lectno=#lectno#
select a.scdno,a.dday,a.dtime,a.istalk,a.isemail,a.issms,a.isuse
from scdlect a
order by a.scdno
insert into scdlectlog (userno,scdno,dday,dtime,istalk,isemail,issms,isuse, )
select #uno#,scdno,dday,dtime,istalk,isemail,issms,isuse,
from scdlect;
update scdlect a
inner join (
select #Ds[].scdno# scdno,#Ds[].dday# dday,#Ds[].dtime# dtime,#Ds[].istalk# istalk,#Ds[].isemail# isemail,#Ds[].issms# issms,#Ds[].isuse# isuse
) b on b.scdno=a.scdno
set a.dday=b.dday,a.dtime=b.dtime,a.istalk=b.istalk,a.isemail=b.isemail,a.issms=b.issms,a.isuse=b.isuse,a.udt= ,a.uno=#uno#,a.uip=#uip#;
insert into scdlect (scdno,dday,dtime,istalk,isemail,issms,isuse, )
select a.scdno,a.dday,a.dtime,a.istalk,a.isemail,a.issms,a.isuse,
from (
select #Ds[].scdno# scdno,#Ds[].dday# dday,#Ds[].dtime# dtime,#Ds[].istalk# istalk,#Ds[].isemail# isemail,#Ds[].issms# issms,#Ds[].isuse# isuse
) a
left outer join scdlect b on b.scdno=a.scdno
where b.scdno is null
select a.scdno,a.dday,a.istalk,a.isemail,a.issms
,d.userno,d.username
,b.cmno cmexno,b.cname,null stime
,null etime,null studyplace,null days
,CAST(AES_DECRYPT(UNHEX(d.email), ) AS char) email,CAST(AES_DECRYPT(UNHEX(d.mobile), ) AS char) mobile
from scdlect a
inner join cm b on b.ismaster=0 and b.cshape in (0,1,2) and b.isuse=1 and b.isdel=0
inner join lect c on c.cmno=b.cmno and c.attrate < 80 and c.status=1 and c.ischanged=0 and date_format(c.edate,'%Y%m%d')=date_format(date_add(now(), interval a.dday day), '%Y%m%d')
inner join users d on d.userno=c.userno and d.status=1
where a.scdno < 3 and a.isuse=1 and a.dtime=#dtime#
union all
select a.scdno,a.dday,a.istalk,a.isemail,a.issms
,d.userno,d.username
,b.cmno cmexno,b.cname,null stime
,null etime,null studyplace,null days
,CAST(AES_DECRYPT(UNHEX(d.email), ) AS char) email,CAST(AES_DECRYPT(UNHEX(d.mobile), ) AS char) mobile
from scdlect a
inner join cm b on b.ismaster=0 and b.cshape in (0,1,2) and b.isuse=1 and b.isdel=0
inner join lect c on c.cmno=b.cmno and c.status=1 and c.ischanged=0 and date_format(c.edate,'%Y%m%d')=date_format(date_add(now(), interval a.dday day), '%Y%m%d')
inner join users d on d.userno=c.userno and d.status=1
inner join cmex e on e.cmno=c.cmno and e.extype=case when a.scdno=3 then 0 else 1 end and e.isdel=0
left outer join lectex f on f.lectno=c.lectno and f.exno=e.exno
where a.scdno > 2 and a.scdno < 5 and a.isuse=1 and a.dtime=#dtime# and f.lectno is null
union all
select a.scdno,a.dday,a.istalk,a.isemail,a.issms
,d.userno,d.username
,b.cmno cmexno,b.cname,null stime
,null etime,null studyplace,null days
,CAST(AES_DECRYPT(UNHEX(d.email), ) AS char) email,CAST(AES_DECRYPT(UNHEX(d.mobile), ) AS char) mobile
from scdlect a
inner join cm b on b.ismaster=0 and b.cshape in (0,1,2) and b.isuse=1 and b.isdel=0
inner join lect c on c.cmno=b.cmno and c.status=1 and c.ischanged=0 and date_format(c.edate,'%Y%m%d')=date_format(date_add(now(), interval a.dday day), '%Y%m%d')
inner join users d on d.userno=c.userno and d.status=1
inner join cmsd e on e.cmno=c.cmno and e.sdtype=0 and e.isdel=0
left outer join lectsd f on f.lectno=c.lectno and f.sdno=e.sdno
where a.scdno=5 and a.isuse=1 and a.dtime=#dtime# and f.lectno is null
union all
select a.scdno,a.dday,a.istalk,a.isemail,a.issms
,d.userno,d.username
,b.cmno cmexno,b.cname,null stime
,null etime,null studyplace,null days
,CAST(AES_DECRYPT(UNHEX(d.email), ) AS char) email,CAST(AES_DECRYPT(UNHEX(d.mobile), ) AS char) mobile
from scdlect a
inner join cm b on b.ismaster=0 and b.cshape in (0,1,2) and b.isuse=1 and b.isdel=0
inner join lect c on c.cmno=b.cmno and c.status=1 and c.ischanged=0 and date_format(c.edate,'%Y%m%d')=date_format(date_add(now(), interval a.dday day), '%Y%m%d')
inner join users d on d.userno=c.userno and d.status=1
inner join cmsd e on e.cmno=c.cmno and e.sdtype=1 and e.isdel=0
left outer join lectsd f on f.lectno=c.lectno and f.sdno=e.sdno
where a.scdno=6 and a.isuse=1 and a.dtime=#dtime# and f.lectno is null
union all
select a.scdno,a.dday,a.istalk,a.isemail,a.issms
,d.userno,d.username
,b.cmno cmexno,b.cname,null stime
,null etime,null studyplace,null days
,CAST(AES_DECRYPT(UNHEX(d.email), ) AS char) email,CAST(AES_DECRYPT(UNHEX(d.mobile), ) AS char) mobile
from scdlect a
inner join cm b on b.ismaster=0 and b.cshape in (0,1,2) and b.isuse=1 and b.isdel=0
inner join lect c on c.cmno=b.cmno and c.status=1 and c.ischanged=0 and date_format(c.edate,'%Y%m%d')=date_format(date_add(now(), interval a.dday day), '%Y%m%d')
inner join users d on d.userno=c.userno and d.status=1
inner join cmrs e on e.cmno=c.cmno and e.rstype=0 and e.isdel=0
left outer join lectrs f on f.lectno=c.lectno and f.rsno=e.rsno
where a.scdno=7 and a.isuse=1 and a.dtime=#dtime# and f.lectno is null
union all
select a.scdno,a.dday,a.istalk,a.isemail,a.issms
,d.userno,d.username
,b.cmno cmexno,b.cname,c.sdate stime
,c.edate etime,e.cname studyplace,b.studytime days
,CAST(AES_DECRYPT(UNHEX(d.email), ) AS char),CAST(AES_DECRYPT(UNHEX(d.mobile), ) AS char)
from scdlect a
inner join cm b on b.ismaster=0 and b.cshape =1 and b.isuse=1 and b.isdel=0
inner join lect c on c.cmno=b.cmno and c.status=1 and c.ischanged=0 and date_format(c.sdate,'%Y%m%d')=date_format(date_add(now(), interval a.dday day), '%Y%m%d')
inner join users d on d.userno=c.userno and d.status=1
left outer join comcode e on e.ccode = b.studyplace
where a.scdno=8 and a.isuse=1 and a.dtime=#dtime#
union all
select a.scdno,a.dday,a.istalk,a.isemail,a.issms
,d.userno,d.username
,b.exno cmexno,b.exname cname,b.estime stime
,null etime,null studyplace,null days
,CAST(AES_DECRYPT(UNHEX(d.email), ) AS char),CAST(AES_DECRYPT(UNHEX(d.mobile), ) AS char)
from scdlect a
inner join exam b on date_format(b.estime,'%Y%m%d')=date_format(date_add(now(), interval a.dday day), '%Y%m%d') and b.isopen=1
inner join examuser c on c.exno=b.exno and c.status=1 and c.pstatus=1
inner join users d on d.userno=c.userno and d.status=1
where a.scdno=9 and a.isuse=1 and a.dtime=#dtime#
insert into alarms (userno,atime,scdno,cmexno,dday,isdel, )
select a.userno, ,a.scdno,a.cmexno,a.dday,0,
from (
) a;
select a.rsno,a.rstype,a2.rscno,a2.rscname,b.cshape,b.cname,b.classno,b.rstime,b.retime,b.sstime,b.setime
,c.tyear,c.tseq
,count(distinct d.lectno) countlect,count(distinct e.lectno) countok
from cmrs a
inner join rsc a2 on a2.rscno=a.rscno
inner join cm b on b.cmno=a.cmno
inner join term c on c.tmno=b.tmno
inner join lect d on d.cmno=b.cmno and d.status=1 and d.ischanged=0
left outer join lectrs e on e.lectno=d.lectno and e.rsno=a.rsno
where a.rsno=#rsno#
group by a.rsno,a.rstype,a2.rscno,a2.rscname,b.cshape,b.cname,b.classno,b.rstime,b.retime,b.sstime,b.setime,c.tyear,c.tseq
select a.rsno
,b.rscqno
,c.qno,c.qtext,c.atype
,d.qino,d.qitext
,sum(case when concat(',',e.atext,',') like concat('%,',d.qino,',%') then 1 else 0 end) scount
,count(e.atext) acount
,group_concat(e.atext order by e.cdt separator ']]>') atext
from cmrs a
inner join rscq b on b.rscno=a.rscno
inner join question c on c.qno=b.qno
left outer join questionitem d on d.qno=c.qno and d.isdel=0
left outer join lectrs e on e.rsno=a.rsno and e.rscqno=b.rscqno
where a.rsno=#rsno#
group by a.rsno
,b.rscqno
,c.qno,c.qtext,c.atype
,d.qino,d.qitext
order by b.dseq,b.qno,d.qino
select a.rscqno,a.qno,q.atype,qi.qino,row_number() over(partition by qi.qno order by qi.qino) rno
from rscq a
inner join question q on q.qno=a.qno
left outer join questionitem qi on qi.qno=q.qno and qi.isdel=0
where a.rscno=#rscno#
order by a.dseq
select a.*
from (
select a.eduno,a.etype,a.userno,a.edate,a.esubject,a.etarget,a.ecount,a.eplace,a.ecomment,a.compname,a.ceoname,a.brno,a.addr,a.btype,a.bkind,a.manname
,CAST(AES_DECRYPT(UNHEX(a.email), ) AS char) email
,CAST(AES_DECRYPT(UNHEX(a.telno), ) AS char) telno
,a.fgno,a.cdt
,b.userid,b.username
,c.asname
,row_number() over(order by $orderby$ a.cdt desc ) rno
,count(a.cdt) over() pagetotalcount
from edub2b a
inner join users b on b.userno=a.userno
left outer join assign c on c.asno=b.asno
a.eduno=#eduno#
) a
order by a.rno
select a.lectno,a.cmno,a.userno,b.userid
from lect a
inner join users b on b.userno = a.userno
a.cmno = #cmno#
a.userno=#userno#
a.cmno in ($cmnos$)
b.userid in ($userids$)
and a.ischanged=0 and a.status < 5
select a.lectno,a.cmno,a.userno
from lect a
where
a.cmno in ($cmnos$) and a.ischanged=0 and a.status < 5
select a.userno,a.lectno,a.cmno
from lect a
where
a.cmno in ($cmnos$) and a.ischanged=0 and a.status < 5
group by a.userno
select c.tyear,c.tseq
,a.cmno,a.cname,a.classno
,b.cmino,b.week,b.iseq,b.ititle,b.idate,b.ist,b.iet
,d.username
from cm a
inner join cminning b on b.cmno=a.cmno and b.isonline=0 and b.idate=#edate#
inner join term c on c.tmno=a.tmno
left outer join users d on d.userno=b.userno
where a.ismaster=0 and a.sstime <=#edate# and a.setime >= #edate# and a.isuse=1 and a.isdel=0
order by b.iet,a.cname
select c.tyear,c.tseq
,b.cshape,b.cname,b.classno
,a.cmino,a.ititle,a.idate,a.ist,a.iet
from cminning a
inner join cm b on b.cmno=a.cmno
inner join term c on c.tmno=b.tmno
where a.cmino=#cmino#
select a.cmino,b.lectno,c.userno
,ca.asname,c.username,c.userid,d.stime,d.etime,d.istatus
,row_number() over(order by d.udt desc,c.username) rno
,count(a.cdt) over() pagetotalcount
from cminning a
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
inner join users c on c.userno=b.userno and c.status=1
left outer join assign ca on ca.asno=c.asno
left outer join lectinning d on d.lectno=b.lectno and d.cmino=a.cmino
where a.cmino=#cmino#
order by rno
select a.*
from (
select a.lectno,c.cmino,b.cmno,b.cshape,b.cname,b2.isoffabs
,a.isrebate,p.payoktime,a.iscomplete
,a.sdate,a.edate
,a.cmisno
,d.sseq,f.cname studyplacename
,d.estart,d.eend
,e.userno,e.userid, e.username
,g.istatus
,row_number() over(order by a.cdt desc,e.username) rno
,count(a.cdt) over() pagetotalcount
from lect a
inner join pay p on p.payno = a.payno
inner join cm b on b.cmno = a.cmno
inner join cmev b2 on b2.cmno = b.cmno
inner join cminning c on c.cmno = b.cmno
left outer join cminningscd d on d.cmisno = a.cmisno and d.cmino = c.cmino
inner join users e on e.userno = a.userno
left outer join comcode f on f.ccode = d.studyplace and f.isuse =1
left outer join lectinning g on g.cmino = c.cmino and g.lectno = a.lectno
where a.status=1 and a.ischanged=0 and c.isscd=1 and c.scdtype=0 and b.cshape=2
and date_format(a.edate,'%Y%m%d') = date_format(#edate#,'%Y%m%d')
and b.cname like concat('%',#cname#,'%')
and d.studyplace = #studyplace#
and e.username like concat('%',#searchtext#,'%')
and e.userid like concat('%',#searchtext#,'%')
) a
order by a.rno
select a.lectno,a.isrebate,a.attrate,a.stime,a.sip,a.etime,a.eip
,b.username,b.userid,b.userno
,c.asname
,count(d.cmino) countinning
,sum(case when e.istatus=2 then 1 else 0 end) countattok
,row_number() over(order by $orderby$ b.username ) rno
,count(a.cdt) over() pagetotalcount
from lect a
inner join users b on b.userno=a.userno and b.status=#ustatus#
left outer join assign c on c.asno=b.asno
inner join cminning d on d.cmno=a.cmno
left outer join lectinning e on e.lectno=a.lectno and e.cmino=d.cmino
where a.ischanged=0 and a.cmno=#cmno# and a.status=#status# and a.isrebate=#isrebate#
group by a.lectno,a.isrebate,a.attrate,a.stime,a.sip,a.etime,a.eip
,b.username,b.userid
,c.asname
order by rno
select b.lectno,a.cmino
,u.userno,u.userid,u.username
,ua.asname
,c.stime,c.etime,c.istatus
,c.udt,d.userid unoid
,row_number() over(order by u.username) rno
,count(b.lectno) over() pagetotalcount
from cminning a
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
inner join users u on u.userno=b.userno and u.status=1
left outer join assign ua on ua.asno=u.asno
left outer join lectinning c on c.lectno=b.lectno and c.cmino=a.cmino
left outer join users d on d.userno = c.uno
left outer join cminningscd e on e.cmisno = b.cmisno
a.cmino=#cmino#
e.cmisno=#cmisno#
b.lectno=#lectno#
group by b.lectno,a.cmino,u.userno,u.userid,u.username,ua.asname,c.stime,c.etime,c.istatus
order by u.username
select a.lectno,b.cmino,d.logno,f.sstime,f.setime
,b.iseq,b.isonline,b.ititle,b.atime
,c.istatus,c.totstudy litotstudy,c.stime listime,c.etime lietime,c.sip lisip,c.eip lieip,c.ispcs liispcs,c.ispce liispce
,c.statustime,c.statusreason,c.statususerno,cu.username statususername,cu.userid statususerid
,d.totstudy,d.stime,d.etime,d.sip,d.eip,d.ispc,d.ispc ispcs,d.webkitinfo
,e.pseq,e.cpno
from lect a
inner join cminning b on b.cmno=a.cmno
inner join cm f on f.cmno=a.cmno
left outer join lectinning c on c.lectno=a.lectno and c.cmino=b.cmino
left outer join users cu on cu.userno=c.statususerno
left outer join lectinningpage d on d.lectno=c.lectno and d.cmino=c.cmino
left outer join ctpage e on e.cpno=d.cpno
a.lectno=#lectno#
a.userno=#userno#
ifnull(b.isscd,0)=#isscd#
order by b.iseq,d.stime
select a.cdt,a.uip,b.pagename,a.loginfo
from pagelog a
left outer join menupage b on b.pno=a.pno
a.logsite=#logsite#
a.userno=#userno#
a.cdt between #start# and #end#
a.cdt >= #from#
a.cdt <= #to#
union all
select a.cdt,a.uip,'로그인', '로그인'
from loginlog a
a.logsite=#logsite#
a.userno=#userno# and a.loginstatus < 2
a.cdt between #start# and #end#
a.cdt >= #from#
a.cdt <= #to#
order by cdt desc
select a.cdt,a.uip,b.pagename,a.loginfo
from (
select cdt, uip, loginfo, pno
from pagelog a
where a.userno=#userno# and a.logsite=#logsite# and DATE_FORMAT(a.cdt, '%Y-%m-%d') = #start#
) a
left outer join menupage b on b.pno=a.pno
a.cdt >= #from#
a.cdt <= #to#
select a.cdt,a.uip,b.pagename,a.loginfo
from menupage b
inner join (
select cdt, uip, loginfo, pno
from pagelog a
where a.userno=#userno# and a.logsite=#logsite# and a.cdt between #start# and #end#
) a on b.pno=a.pno
select a.cdt,a.uip,'로그인' as pagename, '로그인' as loginfo
from loginlog a
a.logsite=#logsite#
a.userno=#userno# and a.loginstatus < 2
a.cdt between #start# and #end#
a.cdt >= #from#
a.cdt <= #to#
select a.*
from (
select a.lectno,a.userno,a.cmno,a.isrebate
,b.exno
,c.estart,c.eend,c.eip,c.tpoint,c.recount,c.entercount,c.cblock
,d.username,d.userid
,e.asname
,row_number() over(order by $orderby$ d.username ) rno
,count(a.cdt) over() pagetotalcount
from lect a
inner join cmex b on b.isdel=0 and b.exno=#exno#
left outer join lectex c on c.lectno=a.lectno and c.exno=b.exno
inner join users d on d.userno=a.userno and d.status = #ustatus#
left outer join assign e on e.asno=d.asno
where a.status=1 and a.ischanged=0
and b.extype = #extype#
and a.cmno = #cmno#
and a.isrebate=#isrebate#
and c.estart is null
and c.estart is not null and c.eend is null
and c.eend is not null
) a
order by a.rno
select a.*
from (
select a.lectno,a.userno,a.cmno,a.isrebate
,p.payoktime,a.sdate,a.edate
,b.exno,b.exname
,b2.cshape,b2.cname
,c.estart,c.eend,c.eip,c.tpoint,c.recount,c.entercount,c.cblock
,d.username,d.userid
,e.asname
,f.cmisno,f.estart lestart,f.eend leend,f.sseq
,g.cname studyplacename
,a.iscomplete
,row_number() over(order by $orderby$ d.username ) rno
,count(a.cdt) over() pagetotalcount
,cast(AES_DECRYPT(UNHEX(d.mobile), 'np123@!' ) as char) as mobile
from lect a
inner join cmex b on b.isdel=0 and b.cmno = a.cmno
inner join cm b2 on b2.cmno = b.cmno
inner join pay p on p.payno = a.payno
left outer join lectex c on c.lectno = a.lectno and c.exno =b.exno
inner join users d on d.userno = a.userno
left outer join assign e on e.asno = d.asno
left outer join cminningscd f on f.cmisno = a.cmisno
left outer join comcode g on g.ccode = f.studyplace and g.isuse =1
where a.status=1 and a.ischanged=0
and b.extype = #extype#
and a.cmno = #cmno#
and a.isrebate=#isrebate#
and (date_format((case when b2.cshape = 2 and f.eend is not null then f.eend else a.edate end),'%Y-%m-%d') = #edate#)
and b2.cshape = #cshape#
and b2.cname like concat('%',#cname#,'%')
and b2.cname like concat('%',#cname#,'%')
and ifnull(a.iscomplete,0) = #iscomplete#
and f.studyplace = #studyplace#
and d.username like concat('%',#usernamestr#,'%')
and d.userid like concat('%',#useridstr#,'%')
and d.username like concat('%',#usernamestr#,'%')
and d.userid like concat('%',#useridstr#,'%')
and c.estart is null
and c.estart is not null and c.eend is null
and c.eend is not null
and (case when b2.cshape = 0 and a.isrebate = 0 then p.payoktime else a.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')
and (case when b2.cshape = 2 then f.eend else a.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')
and e.asname like concat('%',#asname#,'%')
and (cast(AES_DECRYPT(UNHEX(d.mobile), 'np123@!' ) as char) like concat('%',#mobile#,'%'))
and d.status = #ustatus#
) a
order by a.rno
insert into lectexrelog(lectno,exno,estart,eend,eip, )
select a.lectno lectno,a.exno exno,a.estart estart,a.eend eend,a.eip eip,
from lectex a
where a.lectno=#lectno# and a.exno=#exno#;
update lectex set estart=null,eend=null,eip=null,tpoint=0,recount=recount+1,entercount=0,cblock=0 where lectno=#lectno# and exno=#exno#;
update lectexq a
inner join cmex b on b.exno=a.exno
set a.atext=null,a.qinos=null,a.cpoint=0,a.iscorrect=null
where a.lectno=#lectno# and a.exno=#exno#;
select a.*
from (
select a.estart,eend,eip
,row_number() over(order by a.cdt desc) rno
,count(a.cno) over() pagetotalcount
from lectexrelog a
where a.lectno=#lectno# and a.exno=#exno#
) a
order by a.rno
insert into lectexq (lectno,exno,eqno,cpoint,dpoint,qseq, )
select a.lectno,a.exno,d.eqno,0,d.rpoint,row_number() over(order by case when c.israndq=0 then d.qseq else rand() * d.qseq end),
from (select #lectno# lectno, #exno# exno) a
inner join lect a2 on a2.lectno=a.lectno and a2.userno=#userno#
left outer join lectex b on b.lectno=a.lectno and b.exno=a.exno
inner join cmex c on c.exno=a.exno and c.eqtype=0
inner join cmexq d on d.exno=c.exno
inner join (
select count(b.lectno) exq
from (select 1 col1) a
left outer join lectexq b on b.lectno=#lectno# and b.exno=#exno#
) z on z.exq < 1
where b.lectno is null
order by rand();
insert into lectexq (lectno,exno,eqno,cpoint,dpoint,qseq, )
select a.lectno,a.exno,a.eqno,0,a.rpoint,row_number() over(order by case when a.israndq=0 then a.qseq else rand() end),
from (
select a.lectno,a.exno,d.eqno,d.rpoint,el.qcount,c.israndq,d.qseq,rank() over(partition by el.qdiff, el.cc1, el.cc2, el.cc3, el.cc4, el.cc5 order by rand()) rank
from (select #lectno# lectno, #exno# exno) a
inner join lect a2 on a2.lectno=a.lectno and a2.userno=#userno#
left outer join lectex b on b.lectno=a.lectno and b.exno=a.exno
inner join cmex c on c.exno=a.exno and c.eqtype=1
inner join cmexlayer el on el.exno=c.exno and el.qcount > 0
inner join cmexq d on d.exno=el.exno
inner join question e on e.qno=d.qno
and e.qdiff=case when el.qdiff=0 then e.qdiff else el.qdiff end
and e.cc1=case when el.cc1=0 then e.cc1 else el.cc1 end
and e.cc2=case when el.cc2=0 then e.cc2 else el.cc2 end
and e.cc3=case when el.cc3=0 then e.cc3 else el.cc3 end
and e.cc4=case when el.cc4=0 then e.cc4 else el.cc4 end
and e.cc5=case when el.cc5=0 then e.cc5 else el.cc5 end
where b.lectno is null
) a
inner join (
select count(b.lectno) exq
from (select 1 col1) a
left outer join lectexq b on b.lectno=#lectno# and b.exno=#exno#
) z on z.exq < 1
where a.rank <= a.qcount
order by rand();
insert into lectex (lectno,exno,tpoint,recount,cblock, )
select a.lectno,a.exno,0,0,0,
from (select #lectno# lectno, #exno# exno) a
inner join lect a2 on a2.lectno=a.lectno and a2.userno=#userno#
left outer join lectex b on b.lectno=a.lectno and b.exno=a.exno
where b.lectno is null;
select a.exno,a.tpoint extpoint
,b.lectno,b.tpoint
,c.userno,c.username,c.userid
,d.asname
from cmex a
inner join lectex b on b.lectno=#lectno# and b.exno=a.exno
inner join lect b2 on b2.lectno=b.lectno
inner join users c on c.userno=b2.userno
left outer join assign d on d.asno=c.asno
where a.exno=#exno#
select a.lectno,a.exno,a.eqno,a.atext,a.qinos,a.cpoint,a.dpoint,a.iscorrect,a.qseq
,c.qno,c.atype,c.qtext
from lectexq a
inner join cmexq b on b.eqno=a.eqno
inner join question c on c.qno=b.qno
where a.lectno=#lectno# and a.exno=#exno#
order by a.qseq
select c.qno
,sum(case when concat(',',a.atext,',') like concat('%,',c.qino,',%') then 1 else 0 end) countselect
,avg(case when concat(',',a.atext,',') like concat('%,',c.qino,',%') then 100 else 0 end) avgselect
from lectexq a
inner join cmexq b on b.eqno=a.eqno
inner join questionitem c on c.qno=b.qno
where a.exno=#exno# and a.eqno in ($eqnos$) and a.atext is not null
group by c.qno
update lectexq set
,rechecktime=
,cpoint=#cpoint#
,iscorrect = #iscorrect#
where lectno=#lectno# and exno=#exno# and eqno=#eqno#;
update lectex a
inner join (
select lectno, sum(cpoint) tpoint
from lectexq where lectno=#lectno# and exno=#exno#
group by lectno
) b on b.lectno=a.lectno
set a.udt= ,a.uno=#uno#,a.uip=#uip#
,a.tpoint=b.tpoint
,a.rechecktime=
where a.lectno=#lectno# and a.exno=#exno#
select a.lectno,a.userno,a.cmno,a.isrebate
,b.sdno
,c.atext,c.fgno,round((f.MAX_SCORE/100)) copyrate ,c.iscopy,c.cpoint,c.feedb,c.submittime,c.submitip,c.checktime,c.checkip
,cf.fileno,cf.orgname,cf.fileurl
,d.username,d.userid
,e.asname
,row_number() over(order by $orderby$ d.username ) rno
,count(a.cdt) over() pagetotalcount
from lect a
inner join cmsd b on b.isdel=0 and b.cmno = a.cmno and b.sdno=#sdno#
left outer join lectsd c on c.lectno=a.lectno and c.sdno=b.sdno
left outer join fileinfo cf on cf.fgno=c.fgno and cf.isdel=0
inner join users d on d.userno=a.userno and d.status = #ustatus#
left outer join assign e on e.asno=d.asno
left outer join mch_source_v_lectsd_list f on f.DOC_ID = concat(b.sdno ,'_',a.lectno )
where a.status=1 and a.ischanged=0
and b.sdtype=#sdtype#
and a.cmno=#cmno#
and a.isrebate=#isrebate#
and c.submittime is null
and c.submittime is not null
order by rno
select a.*
from (
select a.lectno,a.userno,a.cmno,a.isrebate
,p.payoktime,a.sdate,a.edate
,g.cname,g.cshape
,b.sdno,b.tpoint
,c.atext,round((f.MAX_SCORE/100)) copyrate ,c.iscopy,c.cpoint,c.feedb,c.submittime,c.submitip,c.checktime,c.checkip
,d.username,d.userid,d.usertype
,cast(AES_DECRYPT(UNHEX(d.mobile), 'np123@!' ) as char) as mobile
,e.asname
,h.cmisno,h.estart lestart,h.eend leend,h.sseq
,i.cname studyplacename
,a.iscomplete
,row_number() over(order by $orderby$ d.username ) rno
,count(a.cdt) over() pagetotalcount
from lect a
inner join pay p on p.payno = a.payno
inner join cm g on g.cmno = a.cmno
inner join cmsd b on b.isdel=0 and b.cmno = a.cmno
left outer join lectsd c on c.lectno = a.lectno and c.sdno = b.sdno
inner join users d on d.userno = a.userno
left outer join assign e on e.asno = d.asno
left outer join mch_source_v_lectsd_list f on f.DOC_ID = concat(b.sdno ,'_',a.lectno )
left outer join cminningscd h on h.cmisno = a.cmisno
left outer join comcode i on i.ccode = h.studyplace and i.isuse=1
where a.status=1 and a.ischanged=0
and date_format((case when g.cshape = 2 and h.eend is not null then h.eend else a.edate end),'%Y-%m-%d') = #edate#
and g.cshape = #cshape#
and g.cname like concat('%',#cname#,'%')
and g.cname like concat('%',#cname#,'%')
and ifnull(a.iscomplete,0) = #iscomplete#
and h.studyplace = #studyplace#
and d.username like concat('%',#usernamestr#,'%')
and d.userid like concat('%',#useridstr#,'%')
and b.sdtype=#sdtype#
and a.cmno=#cmno#
and a.isrebate=#isrebate#
and c.submittime is null
and c.submittime is not null
and d.username like concat('%',#searchtext#,'%')
and d.userid like concat('%',#searchtext#,'%')
and (case when g.cshape = 0 and a.isrebate = 0 then p.payoktime else a.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')
and (case when g.cshape = 2 then h.eend else a.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')
and e.asname like concat('%',#asname#,'%')
and cast(AES_DECRYPT(UNHEX(d.mobile), 'np123@!' ) as char) like concat('%',#mobile#,'%')
and d.status = #ustatus#
) a
order by rno
select a.sdno,a.tpoint sdtpoint
,b.lectno,b.atext,b.fgno,round((g.MAX_SCORE/100)) copyrate
,b.iscopy,b.cpoint,b.feedb, b.memo,b.submittime,b.checktime,c.userno,c.username
,c.userid,d.asname,f.fileno,f.orgname,f.fileurl, b2.cmno
from cmsd a
inner join lect b2 on b2.lectno=#lectno#
inner join users c on c.userno=b2.userno
left outer join assign d on d.asno=c.asno
left outer join lectsd b on b.lectno=b2.lectno and b.sdno=a.sdno
left outer join fileinfo f on f.fgno=b.fgno and f.isdel=0
left outer join mch_source_v_lectsd_list g on g.DOC_ID = concat(b.sdno ,'_',b.lectno )
where a.sdno=#sdno#
update lectsd set
,iscopy=#iscopy#,cpoint=#cpoint#
,feedb=#feedb#
,memo=#memo#
,checktime=case when #cpoint# is not null or #feedb# is not null then now() else checktime end
,checkip=case when #cpoint# is not null or #feedb# is not null then #uip# else checkip end
,fgno=#fgno#
where lectno=#lectno# and sdno=#sdno#;
insert into lectsd (lectno,sdno,atext,fgno,copyrate,iscopy,cpoint,feedb,memo,submittime,submitip,checktime,checkip, )
select #lectno#,#sdno#,null,#fgno#,null,#iscopy#,#cpoint#,#feedb#,#memo#,null,null
,case when #cpoint# is not null or #feedb# is not null then now() else null end
,case when #cpoint# is not null or #feedb# is not null then #uip# else null end
,
from (select 1 col1) a
left outer join lectsd b on b.lectno=#lectno# and b.sdno=#sdno#
where b.lectno is null
update lectsd set
,iscopy=#iscopy#,cpoint=#cpoint#,feedb=#feedb#
,checktime=case when #cpoint# is not null or #feedb# is not null then now() else checktime end
,checkip=case when #cpoint# is not null or #feedb# is not null then #uip# else checkip end
where lectno in ($lectnos$) and sdno=#sdno#;
insert into lectsd (lectno,sdno,atext,fgno,copyrate,iscopy,cpoint,feedb,submittime,submitip,checktime,checkip, )
select a.lectno,#sdno#,null,null,null,#iscopy#,#cpoint#,#feedb#,null,null
,case when #cpoint# is not null or #feedb# is not null then now() else null end
,case when #cpoint# is not null or #feedb# is not null then #uip# else null end
,
from lect a
left outer join lectsd b on b.lectno=a.lectno and b.sdno=#sdno#
where a.lectno in ($lectnos$) and a.status=1 and a.ischanged=0 and b.lectno is null
update lectsd set
,cpoint=#cpoint#,feedb=#feedb#
,checktime=case when #cpoint# is not null or #feedb# is not null then now() else checktime end
,checkip=case when #cpoint# is not null or #feedb# is not null then #uip# else checkip end
where lectno=#lectno# and sdno=#sdno#;
insert into lectsd (lectno,sdno,atext,fgno,copyrate,iscopy,cpoint,feedb,submittime,submitip,checktime,checkip, )
select #lectno#,#sdno#,null,null,null,0,#cpoint#,#feedb#,null,null
,case when #cpoint# is not null or #feedb# is not null then now() else null end
,case when #cpoint# is not null or #feedb# is not null then #uip# else null end
,
from (select 1 col1) a
left outer join lectsd b on b.lectno=#lectno# and b.sdno=#sdno#
where b.lectno is null
update lectsd set
,cpoint=#cpoint#,feedb=#feedb#
,checktime=case when #cpoint# is not null or #feedb# is not null then now() else checktime end
,checkip=case when #cpoint# is not null or #feedb# is not null then #uip# else checkip end
where lectno in ($lectnos$) and sdno=#sdno#;
insert into lectsd (lectno,sdno,atext,fgno,copyrate,iscopy,cpoint,feedb,submittime,submitip,checktime,checkip, )
select a.lectno,#sdno#,null,null,null,0,#cpoint#,#feedb#,null,null
,case when #cpoint# is not null or #feedb# is not null then checktime else null end
,case when #cpoint# is not null or #feedb# is not null then #uip# else null end
,
from lect a
left outer join lectsd b on b.lectno=a.lectno and b.sdno=#sdno#
where a.lectno in ($lectnos$) and a.status=1 and a.ischanged=0 and b.lectno is null
select d.orgname,d.fileurl,c.userno,c.userid,c.username
from lectsd a
inner join lect b on b.lectno=a.lectno and b.status=1 and b.ischanged=0
inner join users c on c.userno=b.userno
inner join fileinfo d on d.fgno=a.fgno and d.isdel=0
where a.sdno=#sdno#
select a.lectno,a.userno,a.cmno,a.isrebate
,b.sdno
,c.cpoint,c.feedb,c.submittime,c.submitip,c.checktime,c.checkip
,d.username,d.userid
,e.asname
,count(c2.bno) ccount
,row_number() over(order by $orderby$ d.username ) rno
,count(a.cdt) over() pagetotalcount
from lect a
inner join cmsd b on b.isdel=0 and b.sdno=#sdno#
left outer join lectsd c on c.lectno=a.lectno and c.sdno=b.sdno
left outer join lectsdboard c2 on c2.lectno=c.lectno and c2.sdno=c.sdno and c2.isdel=0
inner join users d on d.userno=a.userno and d.status = #ustatus#
left outer join assign e on e.asno=d.asno
where a.cmno=#cmno# and a.status=1 and a.ischanged=0
and a.isrebate=#isrebate#
group by a.lectno,a.userno,a.cmno,a.isrebate
,b.sdno
,c.cpoint,c.feedb,c.submittime,c.submitip,c.checktime,c.checkip
,d.username,d.userid
,e.asname
having count(c2.bno) $dcount$
order by rno
select a.sdno,a.tpoint sdtpoint
,b.lectno,b.cpoint,b.feedb,b.submittime,b.checktime
,c.userno,c.username,c.userid
,d.asname
from cmsd a
inner join lect b2 on b2.lectno=#lectno#
inner join users c on c.userno=b2.userno
left outer join assign d on d.asno=c.asno
left outer join lectsd b on b.lectno=b2.lectno and b.sdno=a.sdno
where a.sdno=#sdno#
select bno,a.lectno,a.sdno,a.subject,a.contents,a.fgno,a.rcount,a.cdt,a.cip
from lectsdboard a
where a.isdel=0
and a.lectno=#lectno#
and a.sdno=#sdno#
order by a.lectno,a.cdt desc
insert into edub2b (etype,userno,edate,esubject,etarget,ecount,eplace,ecomment,compname,ceoname,brno,addr,btype,bkind,manname,email,telno,fgno, )
values (#etype#,#userno#,#edate#,#esubject#,#etarget#,#ecount#,#eplace#,#ecomment#,#compname#,#ceoname#,#brno#,#addr#,#btype#,#bkind#,#manname#,HEX(AES_ENCRYPT(#email#, )),HEX(AES_ENCRYPT(#telno#, )),#fgno#, )
select a.dtype,a.intval,a.intval2,a.intval3,a.intval4,a.intval5,a.intval6,a.intval7,a.intval8,a.intval9
,a.longval,a.longval2
,a.strval,a.strval2,a.strval3
,a.time,a.time2
,a.time3,a.time4
,a.time5,a.time6
,a.rno
,a.iscomplete
,a.studytime
,a.studyplacename studyplacename,
a.studyplace
,a.cshape
from(
select 1 dtype
,d.tyear intval,d.tseq intval2,c.cshape intval3,a.pstatus intval4,case when e.rfdno is null then 0 else 1 end intval5,a.isrebate intval6,a.itemno intval7
,case when (case when l.sdate is null then c.sstime else l.sdate end) < now() and (case when l.edate is null then c.setime else l.edate end) > now() then 1 else 0 end intval8
,c.studydays intval9
,l.lectno longval,a.payno longval2
,c.cname strval,null strval2,null strval3
,c.rstime time,c.retime time2
,b.cdt time3,f.estart time4
,CASE
WHEN l.sdate IS NULL then
(case
when c.cshape ='1' then f.estart
else l.cdt
end)
ELSE l.sdate
end AS time5
,case
when l.edate is null then f.eend
else l.edate
end time6
,case when b.pstatus = 1 then 99 else b.pstatus end as sortpstatus
,row_number() over(order by sortpstatus, c.retime, b.payno,a.pino) rno
,l.iscomplete
,c.studytime,
cc.cname studyplacename,
cmis.studyplace,
l.cdt
,c.cshape
from payitem a
inner join pay b on b.payno=a.payno and b.pstatus in (21,22,51,55) and b.rstatus < 2
inner join cm c on c.cmno=a.itemno and c.rstime < and c.retime >
inner join lect l on l.cmno=c.cmno and (l.status < 5 or l.status = 6) and l.ischanged=0 and l.userno=b.userno
inner join term d on d.tmno=c.tmno
left outer join payrfd e on e.payno=a.payno and e.payno=a.payno and e.rstatus=0
left outer join cminningscd f on f.cmisno = l.cmisno
LEFT OUTER JOIN cminningscd cmis ON cmis.cmisno = l.cmisno
LEFT OUTER JOIN comcode cc ON cc.ccode = cmis.studyplace and cc.cgroup ='studyplace'
where a.ptype in (0,1,4) and a.userno=#userno# and a.pstatus in (21,22,51,55) and a.rstatus=0
and 1 = case when c.retime = '2099-12-31 23:59:59' and l.stime is not null then 0 else 1 end
order by sortpstatus,l.cdt desc, c.retime desc, b.payno,a.pino
) a
union all
select a.dtype,a.intval,a.intval2,a.intval3,a.intval4,a.intval5,a.intval6,a.intval7,a.intval8,0 intval9
,a.longval,0 longval2
,a.strval,a.strval2,a.strval3
,a.time,a.time2
,a.time3,a.time4
,a.time5,a.time6
,a.rno
,a.iscomplete
,a.studytime,
a.studyplacename studyplacename,
a.studyplace
,a.cshape
from (
select 2 dtype
,c.tyear intval,c.tseq intval2,b.cshape intval3,0 intval4,0 intval5,a.isrebate intval6,a.cmno intval7,0 intval8
,a.lectno longval,0 longval2
,b.cname strval,null strval2,null strval3
,case
WHEN a.sdate IS NULL then
(case
when b.cshape ='1' then d.estart
else a.cdt
end)
ELSE a.sdate
end AS time
,case
when a.edate is null then d.eend
else a.edate
end time2
,d.estart time3,d.eend time4
,e.cdt time5,null time6
,row_number() over(order by b.setime desc) rno
,case when d.eend is not null then d.eend else a.edate end as sortedate
,a.iscomplete
,b.studytime,
cc.cname studyplacename,
cmis.studyplace
,b.cshape
from lect a
inner join pay e on e.payno = a.payno
inner join cm b on b.cmno=a.cmno
inner join term c on c.tmno=b.tmno
left outer join cminningscd d on a.cmisno = d.cmisno
LEFT OUTER JOIN cminningscd cmis ON cmis.cmisno = a.cmisno
LEFT OUTER JOIN comcode cc ON cc.ccode = cmis.studyplace and cc.cgroup ='studyplace'
where a.userno=#userno# and a.status=1 and a.ischanged=0
and (case when a.sdate is null then b.sstime else a.sdate end) <
order by case when time2 > now() then 1 else 0 end asc ,sortedate asc, time2 asc
) a
union all
select a.dtype,a.intval,a.intval2,a.intval3,a.intval4,a.intval5,a.intval6,a.intval7,a.intval8,0 intval9
,a.longval,0 longval2
,a.strval,a.strval2,a.strval3
,a.time,a.time2
,null time3, null time4
,null time5, null time6
,a.rno
,a.iscomplete
,a.studytime,
a.studyplacename studyplacename,
a.studyplace
,a.cshape
from (
select 3 dtype
,1 intval,c.iseq intval2,b.classno intval3,0 intval4,0 intval5,0 intval6,a.cmno intval7,0 intval8
,a.lectno longval
,b.cname strval,null strval2,null strval3
,case when a.sdate is null then b.sstime else a.sdate end as time
,case when a.edate is null then b.setime else a.edate end as time2
,row_number() over(partition by a.cmno order by c.iseq) rno2
,row_number() over(order by b.setime) rno
,a.iscomplete
,b.studytime,
cc.cname studyplacename,
cmis.studyplace
,b.cshape
from lect a
inner join cm b on b.cmno=a.cmno
inner join cminning c on c.cmno=b.cmno and c.isonline=1 and c.isscd = 0
left outer join lectinning d on d.lectno=a.lectno and d.cmino=c.cmino and d.istatus=2
LEFT OUTER JOIN cminningscd cmis ON cmis.cmisno = a.cmisno
LEFT OUTER JOIN comcode cc ON cc.ccode = cmis.studyplace and cc.cgroup ='studyplace'
where a.userno=#userno# and a.status=1 and a.ischanged=0 and d.lectno is null
and a.sdate < and a.edate >
) a
where a.rno2=1
union all
select a.dtype,a.intval,a.intval2,a.intval3,a.intval4,a.intval5,a.intval6,a.intval7,a.intval8,0 intval9
,a.longval,0 longval2
,a.strval,a.strval2,a.strval3
,a.time,a.time2
,null time3, null time4
,null time5, null time6
,a.rno
,a.iscomplete
,a.studytime,
a.studyplacename studyplacename,
a.studyplace
,a.cshape
from (
select 3 dtype
,2 intval,c.iseq intval2,b.classno intval3,0 intval4,0 intval5,0 intval6,a.cmno intval7,0 intval8
,a.lectno longval
,b.cname strval,bc.cname strval2,concat(date_format(c.idate,'%m/%d'),' ',left(c.ist,2),':',right(c.ist,2),' ~ ',left(c.iet,2),':',right(c.iet,2)) strval3
,case when a.sdate is null then b.sstime else a.sdate end as time
,case when a.edate is null then b.setime else a.edate end as time2
,row_number() over(partition by a.cmno order by c.iseq) rno2
,row_number() over(order by b.setime) rno
,a.iscomplete
,b.studytime,
cc.cname studyplacename,
cmis.studyplace
,b.cshape
from lect a
inner join cm b on b.cmno=a.cmno
left outer join comcode bc on bc.ccode=b.studyplace
inner join cminning c on c.cmno=b.cmno and c.isonline=0 and c.isscd = 0
LEFT OUTER JOIN cminningscd cmis ON cmis.cmisno = a.cmisno
LEFT OUTER JOIN comcode cc ON cc.ccode = cmis.studyplace and cc.cgroup ='studyplace'
where a.userno=#userno# and a.status=1 and a.ischanged=0
and a.sdate < and a.edate >
) a
where a.rno2=1
union all
select a.dtype,a.intval,a.intval2,a.intval3,a.intval4,a.intval5,a.intval6,a.intval7,a.intval8,0 intval9
,a.longval,0 longval2
,a.strval,a.strval2,a.strval3
,a.time,a.time2
,null time3, null time4
,null time5, null time6
,a.rno
,a.iscomplete
,a.studytime,
a.studyplacename studyplacename,
a.studyplace
,a.cshape
from (
select 3 dtype
,3 intval,0 intval2,b.classno intval3,c.extype intval4,0 intval5,0 intval6,a.cmno intval7,0 intval8
,a.lectno longval
,b.cname strval,bc.cname strval2,null strval3
,case when a.sdate is null then b.sstime else a.sdate end as time
,case when a.edate is null then b.setime else a.edate end as time2
,row_number() over(partition by a.cmno order by c.extype,c.cdt) rno2
,row_number() over(order by b.setime) rno
,a.iscomplete
,b.studytime,
cc.cname studyplacename,
cmis.studyplace
,b.cshape
from lect a
inner join cm b on b.cmno=a.cmno
left outer join comcode bc on bc.ccode=b.studyplace
inner join cmex c on c.cmno=b.cmno and c.isdel=0 and c.econdition <= a.attrate
LEFT OUTER JOIN cminningscd cmis ON cmis.cmisno = a.cmisno
LEFT OUTER JOIN comcode cc ON cc.ccode = cmis.studyplace and cc.cgroup ='studyplace'
left outer join lectex d on d.lectno=a.lectno and d.exno=c.exno and d.eend is not null
where a.userno=#userno# and a.status=1 and a.ischanged=0 and d.lectno is null
and a.sdate < and a.edate >
) a
where a.rno2=1
union all
select a.dtype,a.intval,a.intval2,a.intval3,a.intval4,a.intval5,a.intval6,a.intval7,a.intval8,0 intval9
,a.longval,0 longval2
,a.strval,a.strval2,a.strval3
,a.time,a.time2
,null time3, null time4
,null time5, null time6
,a.rno
,a.iscomplete
,a.studytime,
a.studyplacename studyplacename,
a.studyplace
,a.cshape
from (
select 3 dtype
,4 intval,0 intval2,b.classno intval3,0 intval4,0 intval5,0 intval6,a.cmno intval7,0 intval8
,a.lectno longval
,b.cname strval,bc.cname strval2,null strval3
,case when a.sdate is null then b.sstime else a.sdate end as time
,case when a.edate is null then b.setime else a.edate end as time2
,row_number() over(partition by a.cmno order by c.cdt) rno2
,row_number() over(order by b.setime) rno
,a.iscomplete
,b.studytime,
cc.cname as studyplacename,
cmis.studyplace
,b.cshape
from lect a
inner join cm b on b.cmno=a.cmno
left outer join comcode bc on bc.ccode=b.studyplace
inner join cmsd c on c.sdtype=0 and c.cmno=b.cmno and c.isdel=0 and c.sdcondition <= a.attrate
left outer join lectsd d on d.lectno=a.lectno and d.sdno=c.sdno and d.submittime is not null
LEFT OUTER JOIN cminningscd cmis ON cmis.cmisno = a.cmisno
LEFT OUTER JOIN comcode cc ON cc.ccode = cmis.studyplace and cc.cgroup ='studyplace'
where a.userno=#userno# and a.status=1 and a.ischanged=0 and d.lectno is null
and a.sdate < and a.edate >
) a
where a.rno2=1
union all
select a.dtype,a.intval,a.intval2,a.intval3,a.intval4,a.intval5,a.intval6,a.intval7,a.intval8,0 intval9
,a.longval,0 longval2
,a.strval,a.strval2,a.strval3
,a.time,a.time2
,null time3, null time4
,null time5, null time6
,a.rno
,a.iscomplete
,a.studytime,
a.studyplacename studyplacename,
a.studyplace
,a.cshape
from (
select 3 dtype
,5 intval,0 intval2,b.classno intval3,0 intval4,0 intval5,0 intval6,a.cmno intval7,0 intval8
,a.lectno longval
,b.cname strval,bc.cname strval2,null strval3
,case when a.sdate is null then b.sstime else a.sdate end as time
,case when a.edate is null then b.setime else a.edate end as time2
,row_number() over(partition by a.cmno order by c.cdt) rno2
,row_number() over(order by b.setime) rno
,a.iscomplete
,b.studytime,
cc.cname studyplacename,
cmis.studyplace
,b.cshape
from lect a
inner join cm b on b.cmno=a.cmno
left outer join comcode bc on bc.ccode=b.studyplace
inner join cmsd c on c.sdtype=1 and c.cmno=b.cmno and c.isdel=0 and c.sdcondition <= a.attrate
left outer join lectsdboard d on d.lectno=a.lectno and d.sdno=c.sdno and d.isdel=0
LEFT OUTER JOIN cminningscd cmis ON cmis.cmisno = a.cmisno
LEFT OUTER JOIN comcode cc ON cc.ccode = cmis.studyplace and cc.cgroup ='studyplace'
where a.userno=#userno# and a.status=1 and a.ischanged=0 and d.lectno is null
and a.sdate < and a.edate >
) a
where a.rno2=1
union all
select a.dtype,a.intval,a.intval2,a.intval3,a.intval4,a.intval5,a.intval6,a.intval7,a.intval8,0 intval9
,a.longval,a.longval2
,a.strval,a.strval2,a.strval3
,a.time,a.time2
,null time3, null time4
,null time5, null time6
,a.rno
,a.iscomplete
,a.studytime,
a.studyplacename studyplacename,
a.studyplace
,a.cshape
from (
select 4 dtype
,a.scdno intval,a.dday intval2,b.classno intval3,0 intval4,0 intval5,0 intval6,b.cmno intval7,0 intval8
,c.lectno longval,a.alno longval2
,b.cname strval,null strval2,null strval3
,a.atime time,c.edate time2
,row_number() over(order by a.atime desc) rno
,c.iscomplete
,b.studytime,
cc.cname studyplacename,
cmis.studyplace
,b.cshape
from alarms a
inner join cm b on b.cmno=a.cmexno
inner join lect c on c.cmno=b.cmno and c.userno=a.userno and c.status=1 and c.ischanged=0
LEFT OUTER JOIN cminningscd cmis ON cmis.cmisno = c.cmisno
LEFT OUTER JOIN comcode cc ON cc.ccode = cmis.studyplace and cc.cgroup ='studyplace'
where a.userno=#userno# and a.scdno < 9 and a.isdel=0
order by a.atime desc
limit 5
) a
update alarms set isdel=1 where alno=#alno# and userno=#userno#
select a.lectno,a.cmno,a.userno,a.isrebate,a.iscomplete,b.studytime,b.outfee
,case when a.sdate is null then b.sstime else a.sdate end as sdate
,case when a.edate is null then b.setime else a.edate end as edate
,b.cmno,b.cname,b.cshape
,b.sstime,b.setime
,b.classno,b.isrefund
,c.tyear,c.tseq
,e.isgroup,e.payno
,u.username,null ccpositionname,CAST(AES_DECRYPT(UNHEX(u.email), ) AS char) email,ua.asname
,1 rno
,e.cdt
,scd.estart,scd.eend
,ccc.cname studyplacename,
cmis.studyplace
,case when scd.eend is not null then scd.eend else a.edate end as sortedate
,ci.scdtype
from lect a
inner join cm b on b.cmno=a.cmno
inner join term c on c.tmno=b.tmno
inner join cg d on d.cgno=b.cgno and d.cgcode=#cgcode#
inner join pay e on e.payno=a.payno and e.isgroup=0
inner join users u on u.userno=a.userno
left outer join assign ua on ua.asno=u.asno
left outer join cminningscd scd on scd.cmisno = a.cmisno
left outer join cminning ci on ci.cmino = scd.cmino
LEFT OUTER JOIN cminningscd cmis ON cmis.cmisno = a.cmisno
LEFT OUTER JOIN comcode ccc ON ccc.ccode = cmis.studyplace and ccc.cgroup ='studyplace'
where a.userno=#userno# and a.status=1 and a.ischanged=0
and b.cshape=#cshape#
and (ifnull(a.iscomplete,0) = 0 and scd.estart > '1900-01-01' and scd.eend > '1900-01-01'
and date_add(a.cdt, interval +1 year) >= date_format(now(),'%Y-%m-%d 23:59:59'))
union all
select a.lectno,a.cmno,a.userno,a.isrebate,a.iscomplete,b.studytime,b.outfee
,case when a.sdate is null then b.sstime else a.sdate end as sdate
,case when a.edate is null then b.setime else a.edate end as edate
,b.cmno,b.cname,b.cshape,b.sstime,b.setime,b.classno,b.isrefund
,c.tyear,c.tseq
,e.isgroup,e.payno
,u.username,null ccpositionname,CAST(AES_DECRYPT(UNHEX(u.email), ) AS char) email,ua.asname
,row_number() over(partition by e.payno) rno
,e.cdt,null estart, null eend
,a.edate as sortedate
,null scdtype,
cc.cname studyplacename,
cmis.studyplace
from pay e
inner join lect a on a.payno=e.payno and a.status=1 and a.ischanged=0
inner join cm b on b.cmno=a.cmno and b.sstime <
inner join term c on c.tmno=b.tmno
inner join cg d on d.cgno=b.cgno and d.iscover=1
inner join users u on u.userno=a.userno
left outer join assign ua on ua.asno=u.asno
LEFT OUTER JOIN cminningscd cmis ON cmis.cmisno = a.cmisno
LEFT OUTER JOIN comcode cc ON cc.ccode = cmis.studyplace and cc.cgroup ='studyplace'
where e.isgroup=1 and e.userno=#userno# and e.pstatus=1
and b.cshape=#cshape#
union all
select a.lectno,a.cmno,a.userno,a.isrebate,a.iscomplete,b.studytime,b.outfee
,case when a.sdate is null then b.sstime else a.sdate end as sdate
,case when a.edate is null then b.setime else a.edate end as edate
,b.cmno,b.cname,b.cshape,b.sstime,b.setime,b.classno,b.isrefund
,c.tyear,c.tseq
,e.isgroup,e.payno
,u.username,null ccpositionname,CAST(AES_DECRYPT(UNHEX(u.email), ) AS char) email,ua.asname
,row_number() over(partition by e.payno) rno
,e.cdt,null estart, null eend
,a.edate as sortedate
,null scdtype,
cc.cname studyplacename,
cmis.studyplace
from lect a0
inner join pay e on e.payno=a0.payno and e.isgroup=1 and e.userno<>#userno# and e.pstatus=1
inner join lect a on a.payno=e.payno and a.status=1 and a.ischanged=0
inner join cm b on b.cmno=a.cmno and b.sstime <
inner join term c on c.tmno=b.tmno
inner join cg d on d.cgno=b.cgno and d.iscover=1
inner join users u on u.userno=a.userno
left outer join assign ua on ua.asno=u.asno
LEFT OUTER JOIN cminningscd cmis ON cmis.cmisno = a0.cmisno
LEFT OUTER JOIN comcode cc ON cc.ccode = cmis.studyplace and cc.cgroup ='studyplace'
where a0.userno=#userno# and a0.status=1 and a0.ischanged=0
and b.cshape=#cshape#
order by case when setime < now() then 0 else 1 end desc,sortedate desc, edate desc,payno
select a.exno,a.userno,a.status,a.payno,a.pino,a.pstatus,a.epoint1,a.epoint2,a.epoint3,a.avrg,a.ispass,a.certdate,a.certindate
,b.exname,b.isopen,b.rstime,b.retime,b.estime,b.elocation,b.isresultopen
,c.certdate firstcertdate
,u.username,u.userid
,cc.cname gradename
from examuser a
inner join exam b on b.exno=a.exno and b.isresultopen=#isresultopen#
left outer join examuserrenew c on c.exno=a.exno and c.userno=a.userno and c.isfirst=1
inner join users u on u.userno=a.userno
inner join comcode cc on cc.ccode=b.certgradecc
a.userno=#userno#
a.status < 9 and a.pstatus < 8
order by a.cdt desc
select a.exno,a.userno,a.certtime,a.certdate,a.certindate,a.renewreason,a.isfirst,a.certidx
,b.username cnoname
from examuserrenew a
left outer join users b on b.userno=a.cno
where a.exno=#exno# and a.userno=#userno#
order by a.certdate desc
select a.*,b.cmno,b.oktime,b.iscomplete
from (
select distinct(c.cmno),c.cname,c.cshape
from examuser a
inner join exam b on b.exno=a.exno
inner join cm c on c.certcc=b.certcc and c.certgradecc=b.certgradecc and c.isdel=0 and c.isuse=1
inner join cg d on d.cgno = c.cgno and d.isuse=1 and d.isdel=0 and d.iscover=1
where a.exno=#exno# and a.userno=#userno#
)a
inner join lect b on b.cmno=a.cmno
where b.status=1 and b.iscomplete=1 and b.ischanged=0 and b.userno=#userno#
group by a.cmno,a.cname,a.cshape,b.oktime,b.iscomplete
limit 3
select 4 dtype,a.scdno intval,a.dday intval2,b.classno intval3,0 intval4,0 intval5,0 intval6,b.cmno intval7
,c.lectno longval,a.alno longval2
,b.cname strval,null strval2,null strval3
,a.atime time,null time2
from alarms a
inner join cm b on b.cmno=a.cmexno
inner join lect c on c.cmno=b.cmno and c.userno=a.userno and c.status=1 and c.ischanged=0
where a.userno=#userno# and date_add(a.atime, interval 3 month) > now() and a.scdno < 9 and a.isdel=0
order by a.atime desc
select a.etime,a.exname,a.tpoint fullpoint,a.isresultopen
,b.estart,b.eend,b.tpoint, b.udt
from cmex a
inner join lectex b on b.lectno=#lectno# and b.exno=a.exno
inner join lect c on c.lectno=b.lectno and c.userno=#userno#
where a.exno=#exno#
select d.atype,b.cpoint,b.dpoint,d.qtext,b.atext,d.qdesc,b.iscorrect,c.qno,b.eqno,b.qseq
from lectex a
inner join lect a2 on a2.lectno=a.lectno and a2.userno=#userno#
inner join lectexq b on b.lectno=a.lectno and b.exno=a.exno
inner join cmexq c on c.eqno=b.eqno
inner join question d on d.qno=c.qno
where a.lectno=#lectno# and a.exno=#exno#
order by b.qseq
select a.qno,a.qitext,b.fileurl,a.isright,a.qino
from questionitem a
left outer join fileinfo b on b.fgno=a.fgno and b.isdel=0
where a.qno in ($qnos$) and a.isdel=0
order by a.qno, a.qino
select a.eqno,sum(a.iscorrect)/count(a.eqno)*100 rightrate
from lectexq a
where a.eqno in ($eqnos$)
group by a.eqno
select a.eqno,sum(case when a.atext = b.atext then 1 else 0 end) / count(b.eqno) * 100 selectrate
from lectexq a
inner join lect a2 on a2.lectno=a.lectno and a2.userno=#userno#
inner join lectexq b on b.exno=a.exno and b.eqno=a.eqno
where a.lectno=#lectno# and a.exno=#exno#
group by a.eqno
select c.tyear,c.tseq,a.cmno,b.cshape,b.cname,b.rstime,b.retime,e.cgcode,b.isrefund
from (
select a.*
from (
select distinct b.ispre idx,c.cmno
from lect a
inner join cmrelay b on b.cmno=a.cmno
inner join cm c on c.ismaster=0 and c.pcmno=b.rcmno and c.rstime < now() and c.retime > now()
left outer join lect d on d.userno=a.userno and d.cmno=c.cmno
where a.userno=#userno# and a.status=1 and a.ischanged=0 and d.lectno is null
order by b.ispre,c.retime
limit 2
) a
union all
select a.*
from (
select 2 idx,c.cmno
from users a
inner join comcode b on b.ccode=a.ccposition
inner join cm c on c.ismaster=0 and c.rstime < now() and c.retime > now() and c.jobpositiongrade like concat('%',b.refcode,'%')
left outer join lect d on d.userno=a.userno and d.cmno=c.cmno
where a.userno=#userno# and d.lectno is null
order by c.retime
limit 2
) a
) a
inner join cm b on b.cmno=a.cmno
inner join term c on c.tmno=b.tmno
inner join cg d on d.cgno=b.cgno
inner join cg e on e.cgno=d.pcgno
order by a.idx,b.retime
limit 2
update lect set
,completetime=#completetime#
where lectno=#lectno# and iscomplete=1;
select ifnull(a.isattcheck,0) intval,b.ischkatt intval2,c.ischkatt intval3
,CAST(AES_DECRYPT(UNHEX(b.mobile), ) AS char) strval
from lect a
inner join users b on b.userno = a.userno
inner join cm c on c.cmno = a.cmno
where a.lectno = #lectno#
select ifnull(d.isattcheck,0) intval,b.ischkatt intval2,c.ischkatt intval3
,CAST(AES_DECRYPT(UNHEX(b.mobile), ) AS char) strval
,b.authplatform strval2
from lect a
inner join users b on b.userno = a.userno
inner join cm c on c.cmno = a.cmno
left outer join lectinning d on d.lectno = a.lectno and d.cmino = #cmino#
where a.lectno = #lectno# and a.userno = #userno#
select a.*
from (
select a.lectno,a.userno,a.iscomplete,a.sdate,a.edate,a.status
,b.cmno,b.cname,b.cshape,b.studytime
,b.rstime,b.retime
,b.sstime,b.setime
,c.tyear,c.tseq
,u.username,u.userid
,e1.asname
,e.payno,e.pstatus,e.payamt,e.ptype,e.ispg,e.pgkey,e.payoktime,e.rstatus,e.iscashrct, e.isbill
,e2.pino,e2.payamt pipayamt,e2.itemname
,f.estart,f.eend
,cc.cname studyplacename
,cc.ccode studyplace
,pt.taxno,pt.taxdate taxdate2,pt.mgtkey,pt.iscancel,pt.statecode,pt.ischeck
,a.cdt
,e.cdt paycdt
,pv.cshrpgkey
,ifnull(pi.isrebate,0) isrebate
,row_number() over(order by a.cdt desc) rno
,count(a.lectno) over() pagetotalcount
from lect a
inner join cm b on b.cmno = a.cmno
inner join term c on c.tmno = b.tmno
inner join pay e on e.payno = a.payno
inner join payitem pi on pi.payno = a.payno
left outer join(
select c.payno,c.pino,c.payamt
,case c.ptype when 0 then c0.cname when 2 then c2.bkname when 4 then c0.cname when 3 then c3.exname else '-' end itemname
from lect a
inner join pay b on b.payno = a.payno
left outer join payitem c on c.payno = b.payno
left outer join cm c0 on c.ptype in (0,1,4) and c0.cmno=c.itemno
left outer join book c2 on c.ptype=2 and c2.bkno=c.itemno
left outer join exam c3 on c.ptype=3 and c3.exno=c.itemno
where a.status in (1,2) and a.ischanged = 0 and a.userno = #userno#
group by a.payno
) e2 on e2.payno = e.payno
left outer join pplog e1 on e1.pplno = e.pplno
left outer join users u on u.userno = a.userno
left outer join assign ass on ass.asno = u.asno
left outer join cminningscd f on f.cmisno = a.cmisno
left outer join comcode cc on cc.ccode = b.studyplace
left outer join paytax pt on pt.payno = e.payno and ifnull(pt.iscancel,0) =0
left outer join payvbankin pv on pv.payno = a.payno
where a.status in (1,2) and a.ischanged=0
and a.cdt >= #cdts#
and a.cdt <= #cdte#
and ass.asname like concat('%',#asname#,'%')
and ass.asno = #asno#
and a.userno = #userno#
and ifnull(a.isrebate,0) in ($isrebates$)
and u.username like concat('%',#username#,'%')
and u.userid like concat('%',#userid#,'%')
and b.cname like concat('%',#itemname#,'%')
and(u.username like concat('%',#usernameiditemname#,'%') or u.userid like concat('%',#usernameiditemname#,'%') or b.cname like concat('%',#usernameiditemname#,'%'))
) a
select no lectno,substr(a.cshape,1,3) cshapename2,a.cgname cname,a.ssdate sstime,a.sedate setime
,case when a.rprice> 0 then 1 else 0 end isrebate
from docprintpast a
inner join users b on b.userpno= a.userpno
where userno = #userno#
update pay a
inner join lect b on b.payno = a.payno and b.cmno = #cmno# and b.ischanged=0 and ifnull(b.isready,0) = 1 and b.status = 4 and DATE_ADD(b.oktime, INTERVAL 2 DAY) <
set a.pstatus = 52, a.udt = now(), a.uno = #uno#, a.uip = #uip#;
update payitem a
inner join pay b on b.payno = a.payno and b.pstatus = 52
inner join lect c on c.payno = b.payno and c.cmno = #cmno# and c.ischanged=0 and ifnull(c.isready,0) = 1 and c.status = 4 and DATE_ADD(c.oktime, INTERVAL 2 DAY) <
set a.pstatus = b.pstatus, a.udt = now(), a.uno = #uno#, a.uip = #uip#;
update lect
set status = 5, oktime = now(), udt = now(), uno = #uno#, uip = #uip#
where cmno = #cmno# and ifnull(isready,0) = 1 and ischanged=0 and status = 4 and DATE_ADD(oktime, INTERVAL 2 DAY) <
update lect
set isattcheck = 1,
lakey = #lakey#,
latime = now()
where lectno = #lectno#
update lectinning a
inner join lect b on b.lectno=a.lectno and b.userno=#userno#
set a.isattcheck = #isattcheck#,a.udt=now(),a.uno=#uno#,a.uip=#uip#
where a.lectno=#lectno# and a.cmino=#cmino#;
insert into lectinning (lectno,cmino,totstudy,stime,etime,istatus,finishtime,sip,eip,ispcs,ispce,pseq,psec,isattcheck, )
select #lectno#,a.cmino,0,now(),now(),case when a.atime=0 then 2 else 0 end,case when a.atime=0 then now() else null end,#uip#,#uip#,1,null,ctp.pseq,0,#isattcheck#,
from cminning a
inner join ctpage ctp on ctp.ctno=a.ctno and ctp.isdel=0 and ctp.pseq=1
left outer join lectinning b on b.lectno=#lectno# and b.cmino=#cmino#
where a.cmino=#cmino# and b.lectno is null;
update lect
set cmisno = #cmisno#
where lectno = #lectno#;
update pplog a
left outer join (
select a.lectno,a.payno,b.pplno,a.cmisno
from lect a
inner join pay b on b.payno = a.payno
where a.lectno = #lectno#
) b on b.pplno = a.pplno
set a.cmisno = b.cmisno
where b.lectno = #lectno#;
update lect a
left outer join cminningscd b on b.cmisno = a.cmisno
set a.edate = case when a.edate is not null then case when b.eend is not null then date_format(b.eend,'%Y-%m-%d 23:59:59') else a.edate end else a.edate end
where a.lectno = #lectno#;
select count(c.cmisno )
from lect a
inner join cminningscd b on b.cmisno = a.cmisno
left outer join cminningscd c on c.cmisno = #cmisno# and date_format(c.estart ,'%Y%m%d') = date_format(b.estart ,'%Y%m%d')
where a.status in (1,2) and a.ischanged =0
and a.userno = #userno#
select a.logno longval
,a.lectno intval,a.cmino intval2,max(a.intval+a.intval2) intval3
,a.strval,a.strval2,a.intval3 intval4
from(
select a.logno,a.lectno,a.cmino
,case when b.edate < then 0 when b.status <> 1 then 0 else case when a.stime = a.etime then 1 else 0 end end intval
,case when b.edate < then 0 when b.status <> 1 then 0 else case when (timestampdiff(second,a.stime,a.etime)%300) = 0 then 1 else 0 end end intval2
,c.cname strval,d.ititle strval2,d.iseq intval3
from lectinningpage a
inner join lect b on b.lectno = a.lectno
inner join cm c on c.cmno = b.cmno
inner join cminning d on d.cmino = a.cmino
where b.userno = #userno#
order by a.cdt desc
limit 1
) a
select e.qno,b.eqno,e.qino,e.qitext,d.atype,c.atext,d.ispassspace,d.isignorecase
from cmex a
inner join cmexq b on b.exno = a.exno
inner join lectexq c on c.eqno = b.eqno
inner join question d on d.qno = b.qno
inner join questionitem e on e.qno = d.qno
where e.isright =1 and e.isdel=0
and a.exno = #exno#
and c.lectno = #lectno#
and b.eqno in ($eqnos$)
order by e.qno,e.qino
select max(lectCnt) * min(checkNum)
from (
select count(t1.lectno) as lectCnt, 1 as checkNum
from lect t1
inner join cm t2 on t1.cmno = t2.cmno
inner join cg t3 on t2.cgno= t3.cgno
inner join pay t4 on t1.payno = t4.payno
inner join pplog t5 on t1.cmno= t5.cmno and t1.userno = t5.userno and t4.pplno = t5.pplno
where (t1.status = 1 or t1.status = 2) and (t4.pstatus= 1 or t4.pstatus=22) and t5.typeman = 28
and t1.userno = #userno#
and t5.typegrade in (38,39)
and t3.cgcode in (103,104)
and t3.cgcode = 105
union
select 0 as lectCnt, (case when count(t1.lectno) > 0 then -1 else 1 end) as checkNum
from lect t1
inner join cm t2 on t1.cmno = t2.cmno
inner join cg t3 on t2.cgno= t3.cgno
where (t1.status = 1 or t1.status = 2) and t2.isdel= 0 and t2.isuse= 1 and t2.ismaster = 0 and t1.userno = #userno# and t2.pcmno = #pcmno#
)t
select max(lectCnt) * min(checkNum)
from (
select count(t1.lectno) as lectCnt, 1 as checkNum
from lect t1
inner join cm t2 on t1.cmno = t2.cmno
inner join cg t3 on t2.cgno= t3.cgno
inner join pay t4 on t1.payno = t4.payno
inner join pplog t5 on t1.cmno= t5.cmno and t1.userno = t5.userno and t4.pplno = t5.pplno
where (t1.status = 1 or t1.status = 2) and (t4.pstatus= 1 or t4.pstatus=22) and t3.cgcode in (103,104,105) and t5.typegrade = #grade# and t5.typeedu = #edu#
and t1.userno = #userno# and t5.typeman = 28
union
select 0 as lectCnt, (case when count(t1.lectno) > 0 then -1 else 1 end) as checkNum
from lect t1
inner join cm t2 on t1.cmno = t2.cmno
inner join cg t3 on t2.cgno= t3.cgno
where (t1.status = 1 or t1.status = 2) and t2.isdel= 0 and t2.isuse= 1 and t2.ismaster = 0 and t1.userno = #userno# and t2.pcmno = #pcmno#
)t
select max(lectCnt) * min(checkNum)
from (
select count(t1.lectno) as lectCnt, 1 as checkNum
from lect t1
inner join cm t2 on t1.cmno = t2.cmno
inner join cg t3 on t2.cgno= t3.cgno
inner join pay t4 on t1.payno = t4.payno
inner join pplog t5 on t1.cmno= t5.cmno and t1.userno = t5.userno and t4.pplno = t5.pplno
where (t1.status = 1 or t1.status = 2) and (t4.pstatus= 1 or t4.pstatus=22) and t3.cgcode in (103,104) and t5.typeedu = 30
and t1.userno = #userno# and t5.typeman = 28
union
select 0 as lectCnt, (case when count(t1.lectno) > 0 then -1 else 1 end) as checkNum
from lect t1
inner join cm t2 on t1.cmno = t2.cmno
inner join cg t3 on t2.cgno= t3.cgno
where (t1.status = 1 or t1.status = 2) and t2.isdel= 0 and t2.isuse= 1 and t2.ismaster = 0 and t1.userno = #userno# and t2.pcmno = #pcmno#
)t